Skip to content

Commit 70e305a

Browse files
authored
Complete test fixtures for invalid selector expressions, fixes #279 (#280)
There were no tests for the full set of forbidden selector expressions. That made it possible to pass the existing test suite while adding `FTL.Placeable` to the list of allowed grammar productions in `abstract.js`. The test coverage is split between `select_expressions.ftl`, and `reference_expressions.ftl`.
1 parent 94dae4d commit 70e305a

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

test/fixtures/select_expressions.ftl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ invalid-selector-term-variant =
2121
*[key] value
2222
}
2323
24+
# ERROR Nested expressions are not valid selectors
25+
invalid-selector-select-expression =
26+
{ { 3 } ->
27+
*[key] default
28+
}
29+
30+
# ERROR Select expressions are not valid selectors
31+
invalid-selector-nested-expression =
32+
{ { $sel ->
33+
*[key] value
34+
} ->
35+
*[key] default
36+
}
37+
2438
empty-variant =
2539
{ $sel ->
2640
*[key] {""}

test/fixtures/select_expressions.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,24 @@
145145
"annotations": [],
146146
"content": "invalid-selector-term-variant =\n { -term(case: \"nominative\") ->\n *[key] value\n }\n\n"
147147
},
148+
{
149+
"type": "Comment",
150+
"content": "ERROR Nested expressions are not valid selectors"
151+
},
152+
{
153+
"type": "Junk",
154+
"annotations": [],
155+
"content": "invalid-selector-select-expression =\n { { 3 } ->\n *[key] default\n }\n\n"
156+
},
157+
{
158+
"type": "Comment",
159+
"content": "ERROR Select expressions are not valid selectors"
160+
},
161+
{
162+
"type": "Junk",
163+
"annotations": [],
164+
"content": "invalid-selector-nested-expression =\n { { $sel ->\n *[key] value\n } ->\n *[key] default\n }\n\n"
165+
},
148166
{
149167
"type": "Message",
150168
"id": {

0 commit comments

Comments
 (0)