deno.land / std@0.166.0 / path / isabsolute_test.ts

isabsolute_test.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.// Copyright the Browserify authors. MIT License.// Ported from https://github.com/browserify/path-browserify/import { assertEquals } from "../testing/asserts.ts";import * as path from "./mod.ts";
Deno.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);});
Deno.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);});
std
Deno standard library
GitHub Repositorydenoland/deno_std
GitHub Stars
2458

Version Info

Tagged at
2 months ago