Skip to content

Commit c082baa

Browse files
committed
a few more comment tests
1 parent 849d950 commit c082baa

File tree

2 files changed

+85
-8
lines changed

2 files changed

+85
-8
lines changed
+44-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,49 @@
11
let someDict = dict{
2-
"one": "one",
2+
"one": "one",
33
}
44

55
let dict{"one": ?one} = someDict
66

7-
let foo = () => switch someDict {
8-
| dict{"one": "one"} => Js.log("one")
9-
| _ => Js.log("not one")
10-
}
7+
let foo = () => {
8+
let _ = switch someDict {
9+
// Comment here
10+
| dict{
11+
// Comment above the pattern
12+
"one":
13+
// Comment right in the pattern
14+
"one",
15+
} =>
16+
Js.log("one")
17+
| _ => Js.log("not one")
18+
}
19+
20+
let _ = switch someDict {
21+
| dict{
22+
// foo
23+
"one": "one",
24+
// bar
25+
"twoooooooooo": 2,
26+
// baz
27+
"three": 3,
28+
"fooooour": 4,
29+
"fiiiive": 5,
30+
} =>
31+
Js.log("one")
32+
| _ => Js.log("not one")
33+
}
34+
35+
let _ = switch someDict {
36+
| dict{
37+
/* foo */
38+
/* baz */ "one": "one",
39+
/* bar */
40+
/* baz */ "twoooooooooo": 2,
41+
/* baz */
42+
/* baz */ "three": 3,
43+
"fooooour": 4,
44+
"fiiiive": 5,
45+
} =>
46+
Js.log("one")
47+
| _ => Js.log("not one")
48+
}
49+
}

jscomp/syntax/tests/printer/pattern/expected/dict.res.txt

+41-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,46 @@ let someDict = dict{
44

55
let dict{"one": ?one} = someDict
66

7-
let foo = () =>
8-
switch someDict {
9-
| dict{"one": "one"} => Js.log("one")
7+
let foo = () => {
8+
let _ = switch someDict {
9+
// Comment here
10+
| dict{
11+
// Comment above the pattern
12+
"one":
13+
// Comment right in the pattern
14+
"one",
15+
} =>
16+
Js.log("one")
1017
| _ => Js.log("not one")
1118
}
19+
20+
let _ = switch someDict {
21+
| dict{
22+
// foo
23+
"one": "one",
24+
// bar
25+
"twoooooooooo": 2,
26+
// baz
27+
"three": 3,
28+
"fooooour": 4,
29+
"fiiiive": 5,
30+
} =>
31+
Js.log("one")
32+
| _ => Js.log("not one")
33+
}
34+
35+
let _ = switch someDict {
36+
| dict{
37+
/* foo */
38+
/* baz */ "one": "one",
39+
/* bar */
40+
/* baz */ "twoooooooooo": 2,
41+
/* baz */
42+
/* baz */ "three": 3,
43+
"fooooour": 4,
44+
"fiiiive": 5,
45+
} =>
46+
Js.log("one")
47+
| _ => Js.log("not one")
48+
}
49+
}

0 commit comments

Comments
 (0)