-
Notifications
You must be signed in to change notification settings - Fork 604
/
common_test.ts
44 lines (41 loc) · 959 Bytes
/
common_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
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../testing/asserts.ts";
import { common } from "./mod.ts";
Deno.test({
name: "path - common - basic usage",
fn() {
const actual = common(
[
"file://deno/cli/js/deno.ts",
"file://deno/std/path/mod.ts",
"file://deno/cli/js/main.ts",
],
"/",
);
assertEquals(actual, "file://deno/");
},
});
Deno.test({
name: "path - common - no shared",
fn() {
const actual = common(
["file://deno/cli/js/deno.ts", "https://deno.land/std/path/mod.ts"],
"/",
);
assertEquals(actual, "");
},
});
Deno.test({
name: "path - common - windows sep",
fn() {
const actual = common(
[
"c:\\deno\\cli\\js\\deno.ts",
"c:\\deno\\std\\path\\mod.ts",
"c:\\deno\\cli\\js\\main.ts",
],
"\\",
);
assertEquals(actual, "c:\\deno\\");
},
});