Skip to content

Commit fa8da21

Browse files
committed
Reference tests for patterns starting with special chars
1 parent c48ebe3 commit fa8da21

File tree

2 files changed

+205
-0
lines changed

2 files changed

+205
-0
lines changed

test/fixtures/special_chars.ftl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
bracket-inline =
2+
{ $sel ->
3+
*[key] [Value]
4+
}
5+
6+
# ERROR
7+
bracket-newline =
8+
{ $sel ->
9+
*[key]
10+
[Value]
11+
}
12+
13+
dot-inline =
14+
{ $sel ->
15+
*[key] .Value
16+
}
17+
18+
# ERROR
19+
dot-newline =
20+
{ $sel ->
21+
*[key]
22+
.Value
23+
}
24+
25+
star-inline =
26+
{ $sel ->
27+
*[key] *Value
28+
}
29+
30+
# ERROR
31+
star-newline =
32+
{ $sel ->
33+
*[key]
34+
*Value
35+
}

test/fixtures/special_chars.json

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
{
2+
"type": "Resource",
3+
"body": [
4+
{
5+
"type": "Message",
6+
"id": {
7+
"type": "Identifier",
8+
"name": "bracket-inline"
9+
},
10+
"value": {
11+
"type": "Pattern",
12+
"elements": [
13+
{
14+
"type": "Placeable",
15+
"expression": {
16+
"type": "SelectExpression",
17+
"selector": {
18+
"type": "VariableReference",
19+
"id": {
20+
"type": "Identifier",
21+
"name": "sel"
22+
}
23+
},
24+
"variants": [
25+
{
26+
"type": "Variant",
27+
"key": {
28+
"type": "Identifier",
29+
"name": "key"
30+
},
31+
"value": {
32+
"type": "Pattern",
33+
"elements": [
34+
{
35+
"type": "TextElement",
36+
"value": "[Value]"
37+
}
38+
]
39+
},
40+
"default": true
41+
}
42+
]
43+
}
44+
}
45+
]
46+
},
47+
"attributes": [],
48+
"comment": null
49+
},
50+
{
51+
"type": "Comment",
52+
"content": "ERROR"
53+
},
54+
{
55+
"type": "Junk",
56+
"annotations": [],
57+
"content": "bracket-newline =\n { $sel ->\n *[key]\n [Value]\n }\n\n"
58+
},
59+
{
60+
"type": "Message",
61+
"id": {
62+
"type": "Identifier",
63+
"name": "dot-inline"
64+
},
65+
"value": {
66+
"type": "Pattern",
67+
"elements": [
68+
{
69+
"type": "Placeable",
70+
"expression": {
71+
"type": "SelectExpression",
72+
"selector": {
73+
"type": "VariableReference",
74+
"id": {
75+
"type": "Identifier",
76+
"name": "sel"
77+
}
78+
},
79+
"variants": [
80+
{
81+
"type": "Variant",
82+
"key": {
83+
"type": "Identifier",
84+
"name": "key"
85+
},
86+
"value": {
87+
"type": "Pattern",
88+
"elements": [
89+
{
90+
"type": "TextElement",
91+
"value": ".Value"
92+
}
93+
]
94+
},
95+
"default": true
96+
}
97+
]
98+
}
99+
}
100+
]
101+
},
102+
"attributes": [],
103+
"comment": null
104+
},
105+
{
106+
"type": "Comment",
107+
"content": "ERROR"
108+
},
109+
{
110+
"type": "Junk",
111+
"annotations": [],
112+
"content": "dot-newline =\n { $sel ->\n *[key]\n .Value\n }\n\n"
113+
},
114+
{
115+
"type": "Message",
116+
"id": {
117+
"type": "Identifier",
118+
"name": "star-inline"
119+
},
120+
"value": {
121+
"type": "Pattern",
122+
"elements": [
123+
{
124+
"type": "Placeable",
125+
"expression": {
126+
"type": "SelectExpression",
127+
"selector": {
128+
"type": "VariableReference",
129+
"id": {
130+
"type": "Identifier",
131+
"name": "sel"
132+
}
133+
},
134+
"variants": [
135+
{
136+
"type": "Variant",
137+
"key": {
138+
"type": "Identifier",
139+
"name": "key"
140+
},
141+
"value": {
142+
"type": "Pattern",
143+
"elements": [
144+
{
145+
"type": "TextElement",
146+
"value": "*Value"
147+
}
148+
]
149+
},
150+
"default": true
151+
}
152+
]
153+
}
154+
}
155+
]
156+
},
157+
"attributes": [],
158+
"comment": null
159+
},
160+
{
161+
"type": "Comment",
162+
"content": "ERROR"
163+
},
164+
{
165+
"type": "Junk",
166+
"annotations": [],
167+
"content": "star-newline =\n { $sel ->\n *[key]\n *Value\n }\n"
168+
}
169+
]
170+
}

0 commit comments

Comments
 (0)