1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-26 16:09:27 -05:00
denoland-deno/std/path/isabsolute_test.ts
Bartek Iwańczuk 8feb30e325
BREAKING: remove overload of Deno.test() (#4951)
This commit removes overload of Deno.test() that accepted named
function.
2020-04-28 12:33:09 +02:00

34 lines
1.5 KiB
TypeScript

// Copyright the Browserify authors. MIT License.
// Ported from https://github.com/browserify/path-browserify/
const { test } = Deno;
import { assertEquals } from "../testing/asserts.ts";
import * as path from "./mod.ts";
test("isAbsolute", function () {
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("isAbsoluteWin32", function () {
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);
});