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

dirname_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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// 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("dirname", function () { assertEquals(path.posix.dirname("/a/b/"), "/a"); assertEquals(path.posix.dirname("/a/b"), "/a"); assertEquals(path.posix.dirname("/a"), "/"); assertEquals(path.posix.dirname(""), "."); assertEquals(path.posix.dirname("/"), "/"); assertEquals(path.posix.dirname("////"), "/"); assertEquals(path.posix.dirname("//a"), "//"); assertEquals(path.posix.dirname("foo"), ".");});
Deno.test("dirnameWin32", function () { assertEquals(path.win32.dirname("c:\\"), "c:\\"); assertEquals(path.win32.dirname("c:\\foo"), "c:\\"); assertEquals(path.win32.dirname("c:\\foo\\"), "c:\\"); assertEquals(path.win32.dirname("c:\\foo\\bar"), "c:\\foo"); assertEquals(path.win32.dirname("c:\\foo\\bar\\"), "c:\\foo"); assertEquals(path.win32.dirname("c:\\foo\\bar\\baz"), "c:\\foo\\bar"); assertEquals(path.win32.dirname("\\"), "\\"); assertEquals(path.win32.dirname("\\foo"), "\\"); assertEquals(path.win32.dirname("\\foo\\"), "\\"); assertEquals(path.win32.dirname("\\foo\\bar"), "\\foo"); assertEquals(path.win32.dirname("\\foo\\bar\\"), "\\foo"); assertEquals(path.win32.dirname("\\foo\\bar\\baz"), "\\foo\\bar"); assertEquals(path.win32.dirname("c:"), "c:"); assertEquals(path.win32.dirname("c:foo"), "c:"); assertEquals(path.win32.dirname("c:foo\\"), "c:"); assertEquals(path.win32.dirname("c:foo\\bar"), "c:foo"); assertEquals(path.win32.dirname("c:foo\\bar\\"), "c:foo"); assertEquals(path.win32.dirname("c:foo\\bar\\baz"), "c:foo\\bar"); assertEquals(path.win32.dirname("file:stream"), "."); assertEquals(path.win32.dirname("dir\\file:stream"), "dir"); assertEquals(path.win32.dirname("\\\\unc\\share"), "\\\\unc\\share"); assertEquals(path.win32.dirname("\\\\unc\\share\\foo"), "\\\\unc\\share\\"); assertEquals(path.win32.dirname("\\\\unc\\share\\foo\\"), "\\\\unc\\share\\"); assertEquals( path.win32.dirname("\\\\unc\\share\\foo\\bar"), "\\\\unc\\share\\foo", ); assertEquals( path.win32.dirname("\\\\unc\\share\\foo\\bar\\"), "\\\\unc\\share\\foo", ); assertEquals( path.win32.dirname("\\\\unc\\share\\foo\\bar\\baz"), "\\\\unc\\share\\foo\\bar", ); assertEquals(path.win32.dirname("/a/b/"), "/a"); assertEquals(path.win32.dirname("/a/b"), "/a"); assertEquals(path.win32.dirname("/a"), "/"); assertEquals(path.win32.dirname(""), "."); assertEquals(path.win32.dirname("/"), "/"); assertEquals(path.win32.dirname("////"), "/"); assertEquals(path.win32.dirname("foo"), ".");});
std
Deno standard library
GitHub Repositorydenoland/deno_std
GitHub Stars
2458

Version Info

Tagged at
2 months ago