Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/tests/data-model-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@
"type": "duplicate-variant"
}
]
},
{
"src": ".match {star :string} |*| {{Literal star}} * {{The default}}",
"exp": "The default"
}
]
}
3 changes: 3 additions & 0 deletions test/tests/syntax-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@
{
"src": "bad {:placeholder @attribute=@foo}"
},
{
"src": "bad {:placeholder @attribute=$foo}"
},
{
"src": "{ @misplaced = attribute }"
},
Expand Down
58 changes: 40 additions & 18 deletions test/tests/syntax.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"src": "\\\\",
"exp": "\\"
},
{
"description": "message -> simple-message -> simple-start pattern -> 1*escaped-char",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than having a deep hierarchy in the description, would it be worth splitting this file into multiple? Maybe tests/syntax/simple-message.json, tests/syntax/complex-message.json, etc?

"src": "\\\\\\{\\|\\}",
"exp": "\\{|}"
},
{
"description": "message -> simple-message -> simple-start pattern -> simple-start-char pattern -> ... -> simple-start-char *text-char placeholder",
"src": "hello {world}",
Expand Down Expand Up @@ -174,7 +179,7 @@
"description": "message -> complex-message -> complex-body -> matcher -> match-statement variant -> match selector key quoted-pattern -> \".match\" expression literal quoted-pattern",
"src": ".match{a :f}a{{}}*{{}}",
"exp": "",
"expErrors": [ { "type": "unknown-function" } ]
"expErrors": [{ "type": "unknown-function" }, { "type": "bad-selector" }]
},
{
"description": "... input-declaration -> input s variable-expression ...",
Expand All @@ -196,35 +201,57 @@
"src": ".local $x = {a}{{}}",
"exp": ""
},
{
"description": "input-declaration-like content in complex-message",
"src": "{{.input {$x}}}",
"params": [{ "name": "x", "value": "X" }],
"exp": ".input X"
},
{
"description": "local-declaration-like content in complex-message with leading whitespace",
"src": "{{ .local $x = {$y}}}",
"params": [{ "name": "y", "value": "Y" }],
"exp": " .local $x = Y"
},
{
"description": "... matcher -> match-statement [s] variant -> match 1*([s] selector) variant -> match selector selector variant -> match selector selector variant key s key quoted-pattern",
"src": ".match{a :f}{b :f}a b{{}}* *{{}}",
"exp": "",
"expErrors": [ { "type": "unknown-function" } ]
"expErrors": [
{ "type": "unknown-function" },
{ "type": "bad-selector" },
{ "type": "unknown-function" },
{ "type": "bad-selector" }
]
},
{
"description": "... matcher -> match-statement [s] variant -> match 1*([s] selector) variant -> match selector variant variant ...",
"src": ".match{a :f}a{{}}b{{}}*{{}}",
"exp": "",
"expErrors": [ { "type": "unknown-function" } ]
"expErrors": [{ "type": "unknown-function" }, { "type": "bad-selector" }]
},
{
"description": "... variant -> key s quoted-pattern -> ...",
"src": ".match{a :f}a {{}}*{{}}",
"exp": "",
"expErrors": [ { "type": "unknown-function" } ]
"expErrors": [{ "type": "unknown-function" }, { "type": "bad-selector" }]
},
{
"description": "... variant -> key s key s quoted-pattern -> ...",
"src": ".match{a :f}{b :f}a b {{}}* *{{}}",
"exp": "",
"expErrors": [ { "type": "unknown-function" } ]
"expErrors": [
{ "type": "unknown-function" },
{ "type": "bad-selector" },
{ "type": "unknown-function" },
{ "type": "bad-selector" }
]
},
{
"description": "... key -> \"*\" ...",
"src": ".match{a :f}*{{}}",
"exp": "",
"expErrors": [ { "type": "unknown-function" } ]
"expErrors": [{ "type": "unknown-function" }, { "type": "bad-selector" }]
},
{
"description": "simple-message -> simple-start pattern -> placeholder -> expression -> literal-expression -> \"{\" s literal \"}\"",
Expand Down Expand Up @@ -399,8 +426,8 @@
"exp": "a"
},
{
"description": "... attribute -> \"@\" identifier s \"=\" s variable ...",
"src": "{42 @foo=$bar}",
"description": "... attribute -> \"@\" identifier s \"=\" s quoted-literal ...",
"src": "{42 @foo=|bar|}",
"exp": "42",
"expParts": [
{
Expand All @@ -426,9 +453,9 @@
"exp": "\\"
},
{
"description": "... quoted-literal -> \"|\" quoted-char escaped-char \"|\"",
"src": "{|a\\\\|}",
"exp": "a\\"
"description": "... quoted-literal -> \"|\" quoted-char 1*escaped-char \"|\"",
"src": "{|a\\\\\\{\\|\\}|}",
"exp": "a\\{|}"
},
{
"description": "... unquoted-literal -> number-literal -> %x30",
Expand Down Expand Up @@ -832,7 +859,7 @@
]
},
{
"src": "foo {?reserved @a @b=$c}",
"src": "foo {?reserved @a @b=c}",
"exp": "foo {?}",
"expParts": [
{
Expand Down Expand Up @@ -898,12 +925,7 @@
{
"src": ".l $y = {|bar|} {{}}",
"exp": "",
"expParts": [
{
"type": "literal",
"value": "bar"
}
],
"expParts": [],
"expErrors": [
{
"type": "unsupported-statement"
Expand Down