Skip to content

Commit 4289ff6

Browse files
authored
Migrate constant pattern tests to tall. (#1384)
1 parent d37c9e2 commit 4289ff6

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

test/pattern/constant.stmt

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
40 columns |
2+
>>> List constant in list pattern doesn't force pattern to split.
3+
if (obj case [const [1, 2]]) {;}
4+
<<<
5+
if (obj case [const [1, 2]]) {
6+
;
7+
}
8+
>>> Don't split between name and constant list.
9+
if (obj case (longFieldName: const [first, second, third])) {;}
10+
<<<
11+
if (obj case (
12+
longFieldName: const [
13+
first,
14+
second,
15+
third,
16+
],
17+
)) {
18+
;
19+
}
20+
>>> Split list constant in pattern.
21+
if (obj case const [element, element, element, element]) {;}
22+
<<<
23+
if (obj case const [
24+
element,
25+
element,
26+
element,
27+
element,
28+
]) {
29+
;
30+
}
31+
>>> Map constant in map pattern doesn't force pattern to split.
32+
if (obj case {k: const {1: 2}}) {;}
33+
<<<
34+
if (obj case {k: const {1: 2}}) {
35+
;
36+
}
37+
>>> Don't split between name and constant map.
38+
if (obj case (longFieldName: const {first: 1, second: 2})) {;}
39+
<<<
40+
if (obj case (
41+
longFieldName: const {
42+
first: 1,
43+
second: 2,
44+
},
45+
)) {
46+
;
47+
}
48+
>>> Split map constant in pattern.
49+
if (obj case const {a: element, b: element, c: element}) {;}
50+
<<<
51+
if (obj case const {
52+
a: element,
53+
b: element,
54+
c: element,
55+
}) {
56+
;
57+
}
58+
>>> Don't split between name and const record.
59+
if (obj case (longFieldName: const (first: 1, second: 2))) {;}
60+
<<<
61+
if (obj case (
62+
longFieldName: const (
63+
first: 1,
64+
second: 2,
65+
),
66+
)) {
67+
;
68+
}
69+
>>> Split record constant in pattern.
70+
if (obj case const (element, element, element, element)) {;}
71+
<<<
72+
if (obj case const (
73+
element,
74+
element,
75+
element,
76+
element,
77+
)) {
78+
;
79+
}
80+
>>> Split set constant in pattern.
81+
if (obj case const {element, element, element, element}) {;}
82+
<<<
83+
if (obj case const {
84+
element,
85+
element,
86+
element,
87+
element,
88+
}) {
89+
;
90+
}
91+
>>> Split constant constructor in pattern.
92+
if (obj case const Foo(element, element, element, element)) {;}
93+
<<<
94+
if (obj case const Foo(
95+
element,
96+
element,
97+
element,
98+
element,
99+
)) {
100+
;
101+
}
102+
>>> Split in parenthesized constant expression.
103+
if (obj case const(longArgument + anotherArgument)) {;}
104+
<<<
105+
if (obj
106+
case const (longArgument +
107+
anotherArgument)) {
108+
;
109+
}

0 commit comments

Comments
 (0)