Skip to content

Commit

Permalink
Add callee, member and reference expression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stasm committed Nov 14, 2018
1 parent d254b7a commit f00c21b
Show file tree
Hide file tree
Showing 8 changed files with 602 additions and 129 deletions.
13 changes: 0 additions & 13 deletions test/fixtures/call_expressions.ftl
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
## Callees

function-callee = {FUNCTION()}
term-callee = {-term()}
# ERROR Equivalent to a MessageReference callee.
mixed-case-callee = {Function()}
# ERROR MessageReference is not a valid callee.
message-callee = {message()}
# ERROR VariableReference is not a valid callee.
variable-callee = {$variable()}
## Arguments

positional-args = {FUN(1, "a", msg)}
Expand Down
89 changes: 0 additions & 89 deletions test/fixtures/call_expressions.json
Original file line number Diff line number Diff line change
@@ -1,95 +1,6 @@
{
"type": "Resource",
"body": [
{
"type": "GroupComment",
"content": "Callees"
},
{
"type": "Message",
"id": {
"type": "Identifier",
"name": "function-callee"
},
"value": {
"type": "Pattern",
"elements": [
{
"type": "Placeable",
"expression": {
"type": "CallExpression",
"callee": {
"type": "FunctionReference",
"id": {
"type": "Identifier",
"name": "FUNCTION"
}
},
"positional": [],
"named": []
}
}
]
},
"attributes": [],
"comment": null
},
{
"type": "Message",
"id": {
"type": "Identifier",
"name": "term-callee"
},
"value": {
"type": "Pattern",
"elements": [
{
"type": "Placeable",
"expression": {
"type": "CallExpression",
"callee": {
"type": "TermReference",
"id": {
"type": "Identifier",
"name": "term"
}
},
"positional": [],
"named": []
}
}
]
},
"attributes": [],
"comment": null
},
{
"type": "Comment",
"content": "ERROR Equivalent to a MessageReference callee."
},
{
"type": "Junk",
"annotations": [],
"content": "mixed-case-callee = {Function()}\n\n"
},
{
"type": "Comment",
"content": "ERROR MessageReference is not a valid callee."
},
{
"type": "Junk",
"annotations": [],
"content": "message-callee = {message()}\n"
},
{
"type": "Comment",
"content": "ERROR VariableReference is not a valid callee."
},
{
"type": "Junk",
"annotations": [],
"content": "variable-callee = {$variable()}\n\n"
},
{
"type": "GroupComment",
"content": "Arguments"
Expand Down
46 changes: 46 additions & 0 deletions test/fixtures/callee_expressions.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Callees in placeables.

function-callee-placeable = {FUNCTION()}
term-callee-placeable = {-term()}
# ERROR Messages cannot be parameterized.
message-callee-placeable = {message()}
# ERROR Equivalent to a MessageReference callee.
mixed-case-callee-placeable = {Function()}
# ERROR Message attributes cannot be parameterized.
message-attr-callee-placeable = {message.attr()}
# ERROR Term attributes may not be used in Placeables.
term-attr-callee-placeable = {-term.attr()}
# ERROR Variables cannot be parameterized.
variable-callee-placeable = {$variable()}
## Callees in selectors.

function-callee-selector = {FUNCTION() ->
*[key] Value
}
term-attr-callee-selector = {-term.attr() ->
*[key] Value
}
# ERROR Messages cannot be parameterized.
message-callee-selector = {message() ->
*[key] Value
}
# ERROR Equivalent to a MessageReference callee.
mixed-case-callee-selector = {Function() ->
*[key] Value
}
# ERROR Message attributes cannot be parameterized.
message-attr-callee-selector = {message.attr() ->
*[key] Value
}
# ERROR Term values may not be used as selectors.
term-callee-selector = {-term() ->
*[key] Value
}
# ERROR Variables cannot be parameterized.
variable-callee-selector = {$variable() ->
*[key] Value
}
Loading

0 comments on commit f00c21b

Please sign in to comment.