mirror of
https://github.com/denoland/deno.git
synced 2024-11-30 16:40:57 -05:00
34 lines
1.5 KiB
TypeScript
34 lines
1.5 KiB
TypeScript
|
// Copyright the Browserify authors. MIT License.
|
||
|
// Ported from https://github.com/browserify/path-browserify/
|
||
|
|
||
|
import { test, assertEqual } from "https://deno.land/x/testing/testing.ts";
|
||
|
import * as path from "./index";
|
||
|
|
||
|
test(function isAbsolute() {
|
||
|
assertEqual(path.posix.isAbsolute("/home/foo"), true);
|
||
|
assertEqual(path.posix.isAbsolute("/home/foo/.."), true);
|
||
|
assertEqual(path.posix.isAbsolute("bar/"), false);
|
||
|
assertEqual(path.posix.isAbsolute("./baz"), false);
|
||
|
});
|
||
|
|
||
|
test(function isAbsoluteWin32() {
|
||
|
assertEqual(path.win32.isAbsolute("/"), true);
|
||
|
assertEqual(path.win32.isAbsolute("//"), true);
|
||
|
assertEqual(path.win32.isAbsolute("//server"), true);
|
||
|
assertEqual(path.win32.isAbsolute("//server/file"), true);
|
||
|
assertEqual(path.win32.isAbsolute("\\\\server\\file"), true);
|
||
|
assertEqual(path.win32.isAbsolute("\\\\server"), true);
|
||
|
assertEqual(path.win32.isAbsolute("\\\\"), true);
|
||
|
assertEqual(path.win32.isAbsolute("c"), false);
|
||
|
assertEqual(path.win32.isAbsolute("c:"), false);
|
||
|
assertEqual(path.win32.isAbsolute("c:\\"), true);
|
||
|
assertEqual(path.win32.isAbsolute("c:/"), true);
|
||
|
assertEqual(path.win32.isAbsolute("c://"), true);
|
||
|
assertEqual(path.win32.isAbsolute("C:/Users/"), true);
|
||
|
assertEqual(path.win32.isAbsolute("C:\\Users\\"), true);
|
||
|
assertEqual(path.win32.isAbsolute("C:cwd/another"), false);
|
||
|
assertEqual(path.win32.isAbsolute("C:cwd\\another"), false);
|
||
|
assertEqual(path.win32.isAbsolute("directory/directory"), false);
|
||
|
assertEqual(path.win32.isAbsolute("directory\\directory"), false);
|
||
|
});
|