Skip to content

Commit 7f041b9

Browse files
cknittcristianoc
authored andcommitted
Deactivate filename tests for Windows (path separators don't match)
1 parent 985d2aa commit 7f041b9

File tree

2 files changed

+92
-95
lines changed

2 files changed

+92
-95
lines changed

jscomp/test/a_filename_test.js

Lines changed: 86 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -33,101 +33,92 @@ function test(param, param$1) {
3333
return Ext_filename_test.node_relative_path(true, param, param$1);
3434
}
3535

36-
eq("File \"a_filename_test.ml\", line 10, characters 5-12", [
37-
Ext_filename_test.combine("/tmp", "subdir/file.txt"),
38-
Ext_filename_test.combine("/tmp", "/a/tmp.txt"),
39-
Ext_filename_test.combine("/a/tmp.txt", "subdir/file.txt")
40-
], [
41-
"/tmp/subdir/file.txt",
42-
"/a/tmp.txt",
43-
"/a/tmp.txt/subdir/file.txt"
44-
]);
45-
46-
eq("File \"a_filename_test.ml\", line 22, characters 5-12", Ext_filename_test.node_relative_path(true, {
47-
NAME: "File",
48-
VAL: "./a/b.c"
49-
}, {
50-
NAME: "File",
51-
VAL: "./a/u/g.c"
52-
}), "./u/g.c");
53-
54-
eq("File \"a_filename_test.ml\", line 27, characters 5-12", Ext_filename_test.node_relative_path(true, {
55-
NAME: "File",
56-
VAL: "./a/b.c"
57-
}, {
58-
NAME: "File",
59-
VAL: "xxxghsoghos/ghsoghso/node_modules/buckle-stdlib/list.js"
60-
}), "buckle-stdlib/list.js");
61-
62-
eq("File \"a_filename_test.ml\", line 33, characters 5-12", Ext_filename_test.node_relative_path(true, {
63-
NAME: "File",
64-
VAL: "./a/b.c"
65-
}, {
66-
NAME: "File",
67-
VAL: "xxxghsoghos/ghsoghso/node_modules//buckle-stdlib/list.js"
68-
}), "buckle-stdlib/list.js");
69-
70-
eq("File \"a_filename_test.ml\", line 39, characters 5-12", Ext_filename_test.node_relative_path(true, {
71-
NAME: "File",
72-
VAL: "./a/b.c"
73-
}, {
74-
NAME: "File",
75-
VAL: "xxxghsoghos/ghsoghso/node_modules/./buckle-stdlib/list.js"
76-
}), "buckle-stdlib/list.js");
77-
78-
eq("File \"a_filename_test.ml\", line 45, characters 5-12", Ext_filename_test.node_relative_path(true, {
79-
NAME: "File",
80-
VAL: "./a/c.js"
81-
}, {
82-
NAME: "File",
83-
VAL: "./a/b"
84-
}), "./b");
85-
86-
eq("File \"a_filename_test.ml\", line 50, characters 5-12", Ext_filename_test.node_relative_path(true, {
87-
NAME: "File",
88-
VAL: "./a/c"
89-
}, {
90-
NAME: "File",
91-
VAL: "./a/b.js"
92-
}), "./b.js");
93-
94-
eq("File \"a_filename_test.ml\", line 55, characters 5-12", Ext_filename_test.node_relative_path(true, {
95-
NAME: "Dir",
96-
VAL: "./a/"
97-
}, {
98-
NAME: "File",
99-
VAL: "./a/b.js"
100-
}), "./b.js");
101-
102-
eq("File \"a_filename_test.ml\", line 60, characters 5-12", Ext_filename_test.get_extension("a.txt"), ".txt");
103-
104-
eq("File \"a_filename_test.ml\", line 64, characters 5-12", Ext_filename_test.get_extension("a"), "");
105-
106-
eq("File \"a_filename_test.ml\", line 68, characters 5-12", Ext_filename_test.get_extension(".txt"), ".txt");
107-
108-
eq("File \"a_filename_test.ml\", line 73, characters 5-12", $$Array.map(Ext_filename_test.normalize_absolute_path, [
109-
"/gsho/./..",
110-
"/a/b/../c../d/e/f",
111-
"/a/b/../c/../d/e/f",
112-
"/gsho/./../..",
113-
"/a/b/c/d",
114-
"/a/b/c/d/",
115-
"/a/",
116-
"/a",
117-
"/a.txt/",
118-
"/a.txt"
119-
]), [
120-
"/",
121-
"/a/c../d/e/f",
122-
"/a/d/e/f",
123-
"/",
124-
"/a/b/c/d",
125-
"/a/b/c/d",
126-
"/a",
127-
"/a",
128-
"/a.txt",
129-
"/a.txt"
130-
]);
36+
if (process.platform !== "win32") {
37+
eq("File \"a_filename_test.ml\", line 15, characters 5-12", [
38+
Ext_filename_test.combine("/tmp", "subdir/file.txt"),
39+
Ext_filename_test.combine("/tmp", "/a/tmp.txt"),
40+
Ext_filename_test.combine("/a/tmp.txt", "subdir/file.txt")
41+
], [
42+
"/tmp/subdir/file.txt",
43+
"/a/tmp.txt",
44+
"/a/tmp.txt/subdir/file.txt"
45+
]);
46+
eq("File \"a_filename_test.ml\", line 27, characters 5-12", Ext_filename_test.node_relative_path(true, {
47+
NAME: "File",
48+
VAL: "./a/b.c"
49+
}, {
50+
NAME: "File",
51+
VAL: "./a/u/g.c"
52+
}), "./u/g.c");
53+
eq("File \"a_filename_test.ml\", line 32, characters 5-12", Ext_filename_test.node_relative_path(true, {
54+
NAME: "File",
55+
VAL: "./a/b.c"
56+
}, {
57+
NAME: "File",
58+
VAL: "xxxghsoghos/ghsoghso/node_modules/buckle-stdlib/list.js"
59+
}), "buckle-stdlib/list.js");
60+
eq("File \"a_filename_test.ml\", line 38, characters 5-12", Ext_filename_test.node_relative_path(true, {
61+
NAME: "File",
62+
VAL: "./a/b.c"
63+
}, {
64+
NAME: "File",
65+
VAL: "xxxghsoghos/ghsoghso/node_modules//buckle-stdlib/list.js"
66+
}), "buckle-stdlib/list.js");
67+
eq("File \"a_filename_test.ml\", line 44, characters 5-12", Ext_filename_test.node_relative_path(true, {
68+
NAME: "File",
69+
VAL: "./a/b.c"
70+
}, {
71+
NAME: "File",
72+
VAL: "xxxghsoghos/ghsoghso/node_modules/./buckle-stdlib/list.js"
73+
}), "buckle-stdlib/list.js");
74+
eq("File \"a_filename_test.ml\", line 50, characters 5-12", Ext_filename_test.node_relative_path(true, {
75+
NAME: "File",
76+
VAL: "./a/c.js"
77+
}, {
78+
NAME: "File",
79+
VAL: "./a/b"
80+
}), "./b");
81+
eq("File \"a_filename_test.ml\", line 55, characters 5-12", Ext_filename_test.node_relative_path(true, {
82+
NAME: "File",
83+
VAL: "./a/c"
84+
}, {
85+
NAME: "File",
86+
VAL: "./a/b.js"
87+
}), "./b.js");
88+
eq("File \"a_filename_test.ml\", line 60, characters 5-12", Ext_filename_test.node_relative_path(true, {
89+
NAME: "Dir",
90+
VAL: "./a/"
91+
}, {
92+
NAME: "File",
93+
VAL: "./a/b.js"
94+
}), "./b.js");
95+
eq("File \"a_filename_test.ml\", line 65, characters 5-12", Ext_filename_test.get_extension("a.txt"), ".txt");
96+
eq("File \"a_filename_test.ml\", line 69, characters 5-12", Ext_filename_test.get_extension("a"), "");
97+
eq("File \"a_filename_test.ml\", line 73, characters 5-12", Ext_filename_test.get_extension(".txt"), ".txt");
98+
eq("File \"a_filename_test.ml\", line 78, characters 5-12", $$Array.map(Ext_filename_test.normalize_absolute_path, [
99+
"/gsho/./..",
100+
"/a/b/../c../d/e/f",
101+
"/a/b/../c/../d/e/f",
102+
"/gsho/./../..",
103+
"/a/b/c/d",
104+
"/a/b/c/d/",
105+
"/a/",
106+
"/a",
107+
"/a.txt/",
108+
"/a.txt"
109+
]), [
110+
"/",
111+
"/a/c../d/e/f",
112+
"/a/d/e/f",
113+
"/",
114+
"/a/b/c/d",
115+
"/a/b/c/d",
116+
"/a",
117+
"/a",
118+
"/a.txt",
119+
"/a.txt"
120+
]);
121+
}
131122

132123
Mt.from_pair_suites("A_filename_test", suites.contents);
133124

jscomp/test/a_filename_test.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
external platform : [ `aix | `darwin | `freebsd | `linux | `openbsd | `sunos | `win32 ]
2+
= "platform" [@@var] [@@scope "process"]
3+
14
let suites : Mt.pair_suites ref = ref []
25
let test_id = ref 0
36
let eq loc x y =
@@ -7,6 +10,8 @@ let eq loc x y =
710

811
let test = Ext_filename_test.node_relative_path true
912
let () =
13+
(* TODO: adapt these tests to run on Windows. *)
14+
if platform != `win32 then (
1015
eq __LOC__
1116
(let (//) = Ext_filename_test.combine in
1217
("/tmp"// "subdir/file.txt",
@@ -97,6 +102,7 @@ let () =
97102
"/a.txt"
98103
|]
99104
;
105+
)
100106

101107

102108

0 commit comments

Comments
 (0)