0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
denoland-deno/fs/path/isabsolute_test.ts
Ryan Dahl caa383a583 Rename assertEq to assertEquals (denoland/deno_std#242)
After some discussion it was found that assertEquals is more common
in JS (vs assertEqual, assertEq) and sounds better in the negated form:
assertNotEquals vs assertNE.
Original: 4cf39d4a14
2019-03-06 19:42:24 -05:00

34 lines
1.6 KiB
TypeScript

// Copyright the Browserify authors. MIT License.
// Ported from https://github.com/browserify/path-browserify/
import { test } from "../../testing/mod.ts";
import { assertEquals } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
test(function isAbsolute() {
assertEquals(path.posix.isAbsolute("/home/foo"), true);
assertEquals(path.posix.isAbsolute("/home/foo/.."), true);
assertEquals(path.posix.isAbsolute("bar/"), false);
assertEquals(path.posix.isAbsolute("./baz"), false);
});
test(function isAbsoluteWin32() {
assertEquals(path.win32.isAbsolute("/"), true);
assertEquals(path.win32.isAbsolute("//"), true);
assertEquals(path.win32.isAbsolute("//server"), true);
assertEquals(path.win32.isAbsolute("//server/file"), true);
assertEquals(path.win32.isAbsolute("\\\\server\\file"), true);
assertEquals(path.win32.isAbsolute("\\\\server"), true);
assertEquals(path.win32.isAbsolute("\\\\"), true);
assertEquals(path.win32.isAbsolute("c"), false);
assertEquals(path.win32.isAbsolute("c:"), false);
assertEquals(path.win32.isAbsolute("c:\\"), true);
assertEquals(path.win32.isAbsolute("c:/"), true);
assertEquals(path.win32.isAbsolute("c://"), true);
assertEquals(path.win32.isAbsolute("C:/Users/"), true);
assertEquals(path.win32.isAbsolute("C:\\Users\\"), true);
assertEquals(path.win32.isAbsolute("C:cwd/another"), false);
assertEquals(path.win32.isAbsolute("C:cwd\\another"), false);
assertEquals(path.win32.isAbsolute("directory/directory"), false);
assertEquals(path.win32.isAbsolute("directory\\directory"), false);
});