Skip to content

Commit 97fb765

Browse files
committed
Fix regression coverage execution
1 parent 59ed00e commit 97fb765

6 files changed

Lines changed: 86 additions & 74 deletions

File tree

tests/tests/src/ImportAttributes.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Generated by ReScript, PLEASE EDIT WITH CARE
22

3-
import * as MyCx73sCss from "./myC\\x73s.css" with {"type": "c\\x73s", "some-identifier": "y\\x65p"};
4-
import MyJx73onJson from "./myJ\\x73on.json" with {"type": "j\\x73on", "some-identifier": "y\\x65p"};
3+
import * as MyCssCss from "./myCss.css" with {"type": "c\\x73s", "some-identifier": "y\\x65p"};
4+
import MyJsonJson from "./myJson.json" with {"type": "j\\x73on", "some-identifier": "y\\x65p"};
55

6-
let myJson = MyJx73onJson;
6+
let myJson = MyJsonJson;
77

88
console.log(myJson);
99

10-
let buttonCss = MyCx73sCss.button;
10+
let buttonCss = MyCssCss.button;
1111

1212
console.log(buttonCss);
1313

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
@module({from: `./myJ\x73on.json`, with: {type_: `j\x73on`, \"some-identifier": `y\x65p`}})
1+
@module({from: `./myJson.json`, with: {type_: `j\x73on`, \"some-identifier": `y\x65p`}})
22
external myJson: JSON.t = "default"
33

44
Console.log(myJson)
55

6-
@module({from: `./myC\x73s.css`, with: {type_: `c\x73s`, \"some-identifier": `y\x65p`}})
6+
@module({from: `./myCss.css`, with: {type_: `c\x73s`, \"some-identifier": `y\x65p`}})
77
external buttonCss: string = "button"
88

99
Console.log(buttonCss)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
import * as Mocha from "mocha";
4+
import * as Test_string_switch from "./test_string_switch.mjs";
5+
6+
Mocha.describe("String_switch_test", () => {
7+
Mocha.test("equivalent string escape spellings in switch cases", () => {
8+
if (Test_string_switch.classifyEquivalentEscape("a", 0) !== 5) {
9+
throw {
10+
RE_EXN_ID: "Assert_failure",
11+
_1: [
12+
"string_switch_test.res",
13+
7,
14+
4
15+
],
16+
Error: new Error()
17+
};
18+
}
19+
if (Test_string_switch.classifyEquivalentEscape("a", 1) !== 5) {
20+
throw {
21+
RE_EXN_ID: "Assert_failure",
22+
_1: [
23+
"string_switch_test.res",
24+
8,
25+
4
26+
],
27+
Error: new Error()
28+
};
29+
}
30+
if (Test_string_switch.classifyEquivalentEscape("a", 2) !== 2) {
31+
throw {
32+
RE_EXN_ID: "Assert_failure",
33+
_1: [
34+
"string_switch_test.res",
35+
9,
36+
4
37+
],
38+
Error: new Error()
39+
};
40+
}
41+
if (Test_string_switch.classifyEquivalentEscape("a", 3) !== 5) {
42+
throw {
43+
RE_EXN_ID: "Assert_failure",
44+
_1: [
45+
"string_switch_test.res",
46+
10,
47+
4
48+
],
49+
Error: new Error()
50+
};
51+
}
52+
if (Test_string_switch.classifyEquivalentEscape("a", 4) === 5) {
53+
return;
54+
}
55+
throw {
56+
RE_EXN_ID: "Assert_failure",
57+
_1: [
58+
"string_switch_test.res",
59+
11,
60+
4
61+
],
62+
Error: new Error()
63+
};
64+
});
65+
});
66+
67+
/* Not a pure module */
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
open Mocha
2+
3+
describe(__MODULE__, () => {
4+
test("equivalent string escape spellings in switch cases", () => {
5+
// Equivalent spellings become duplicate JavaScript cases. Only the first
6+
// emitted case can match, so guards on the other cases are skipped.
7+
assert(Test_string_switch.classifyEquivalentEscape("a", 0) == 5)
8+
assert(Test_string_switch.classifyEquivalentEscape("a", 1) == 5)
9+
assert(Test_string_switch.classifyEquivalentEscape("a", 2) == 2)
10+
assert(Test_string_switch.classifyEquivalentEscape("a", 3) == 5)
11+
assert(Test_string_switch.classifyEquivalentEscape("a", 4) == 5)
12+
})
13+
})

tests/tests/src/test_string_switch.mjs

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -48,66 +48,6 @@ function classifyEquivalentEscape(value, selectedCase) {
4848
}
4949
}
5050

51-
if (classifyEquivalentEscape("a", 0) !== 0) {
52-
throw {
53-
RE_EXN_ID: "Assert_failure",
54-
_1: [
55-
"test_string_switch.res",
56-
21,
57-
2
58-
],
59-
Error: new Error()
60-
};
61-
}
62-
63-
if (classifyEquivalentEscape("a", 1) !== 1) {
64-
throw {
65-
RE_EXN_ID: "Assert_failure",
66-
_1: [
67-
"test_string_switch.res",
68-
22,
69-
2
70-
],
71-
Error: new Error()
72-
};
73-
}
74-
75-
if (classifyEquivalentEscape("a", 2) !== 2) {
76-
throw {
77-
RE_EXN_ID: "Assert_failure",
78-
_1: [
79-
"test_string_switch.res",
80-
23,
81-
2
82-
],
83-
Error: new Error()
84-
};
85-
}
86-
87-
if (classifyEquivalentEscape("a", 3) !== 3) {
88-
throw {
89-
RE_EXN_ID: "Assert_failure",
90-
_1: [
91-
"test_string_switch.res",
92-
24,
93-
2
94-
],
95-
Error: new Error()
96-
};
97-
}
98-
99-
if (classifyEquivalentEscape("a", 4) !== 4) {
100-
throw {
101-
RE_EXN_ID: "Assert_failure",
102-
_1: [
103-
"test_string_switch.res",
104-
25,
105-
2
106-
],
107-
Error: new Error()
108-
};
109-
}
110-
11151
export {
11252
version,
11353
classifyEquivalentEscape,

tests/tests/src/test_string_switch.res

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,3 @@ let classifyEquivalentEscape = (value, selectedCase) =>
1616
| "\x61" => 4
1717
| _ => 5
1818
}
19-
20-
let () = {
21-
assert(classifyEquivalentEscape("a", 0) == 0)
22-
assert(classifyEquivalentEscape("a", 1) == 1)
23-
assert(classifyEquivalentEscape("a", 2) == 2)
24-
assert(classifyEquivalentEscape("a", 3) == 3)
25-
assert(classifyEquivalentEscape("a", 4) == 4)
26-
}

0 commit comments

Comments
 (0)