Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Sep 9, 2024
1 parent ee535b4 commit ef280f8
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 314 deletions.
2 changes: 0 additions & 2 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ to the error names used in ["MessageFormat 2.0 Errors"](../spec/errors.md) in th
| Syntax Error | syntax-error |
| Unknown Function | unknown-function |
| Unresolved Variable | unresolved-variable |
| Unsupported Expression | unsupported-expression |
| Unsupported Statement | unsupported-statement |
| Variant Key Mismatch | variant-key-mismatch |

The "Message Function Error" error name used in the spec
Expand Down
2 changes: 0 additions & 2 deletions test/schemas/v0/tests.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@
"duplicate-variant",
"unresolved-variable",
"unknown-function",
"unsupported-expression",
"unsupported-statement",
"bad-selector",
"bad-operand",
"bad-option",
Expand Down
70 changes: 69 additions & 1 deletion test/tests/syntax-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,74 @@
},
{
"src": ".match |x| * {{foo}}"
}
},
{ "src": ".n{a}{{}}" },
{ "src": "{^}" },
{ "src": "{!}" },
{ "src": ".n .{a}{{}}" },
{ "src": ".n. {a}{{}}" },
{ "src": ".n.{a}{b}{{}}" },
{ "src": "{!.}" },
{ "src": "{! .}" },
{ "src": "{%}" },
{ "src": "{*}" },
{ "src": "{+}" },
{ "src": "{<}" },
{ "src": "{>}" },
{ "src": "{?}" },
{ "src": "{~}" },
{ "src": "{^.}" },
{ "src": "{^ .}" },
{ "src": "{&}" },
{ "src": "{!.\\{}" },
{ "src": "{!. \\{}" },
{ "src": "{!|a|}" },
{ "src": "foo {+reserved}" },
{ "src": "foo {&private}" },
{ "src": "foo {?reserved @a @b=c}" },
{ "src": ".foo {42} {{bar}}" },
{ "src": ".foo{42}{{bar}}" },
{ "src": ".foo |}lit{| {42}{{bar}}" },
{ "src": ".i {1} {{}}" },
{ "src": ".l $y = {|bar|} {{}}" },
{ "src": ".l $x.y = {|bar|} {{}}" },
{ "src": "hello {|4.2| %number}" },
{ "src": "hello {|4.2| %n|um|ber}" },
{ "src": "{+42}" },
{ "src": "hello {|4.2| &num|be|r}" },
{ "src": "hello {|4.2| ^num|be|r}" },
{ "src": "hello {|4.2| +num|be|r}" },
{ "src": "hello {|4.2| ?num|be||r|s}" },
{ "src": "hello {|foo| !number}" },
{ "src": "hello {|foo| *number}" },
{ "src": "hello {?number}" },
{ "src": "{<tag}" },
{ "src": ".local $bar = {$none ~plural} .match {foo :string} * {{{$bar}}}" },
{ "src": "hello {|4.2| %num\\\\ber}" },
{ "src": "hello {|4.2| %num\\{be\\|r}" },
{ "src": "hello {|4.2| %num\\\\\\}ber}" },
{ "src": "hello {|4.2| !}" },
{ "src": "hello {|4.2| %}" },
{ "src": "hello {|4.2| *}" },
{ "src": "hello {|4.2| ^abc|123||5|\\\\}" },
{ "src": "hello {|4.2| ^ abc|123||5|\\\\}" },
{ "src": "hello {|4.2| ^ abc|123||5|\\\\ \\|def |3.14||2|}" },
{ "src": "hello {|4.2| ? }" },
{ "src": "hello {|4.2| %xyzz }" },
{ "src": "hello {|4.2| >xyzz }" },
{ "src": "hello {$foo ~xyzz }" },
{ "src": "hello {$x <xyzz }" },
{ "src": "{>xyzz }" },
{ "src": "{ !xyzz }" },
{ "src": "{~xyzz }" },
{ "src": "{ <xyzz }" },
{ "src": "hello {|4.2| !xy z z }" },
{ "src": "hello {|4.2| *num \\\\ b er}" },
{ "src": "hello {|4.2| %num \\\\ b |3.14| r }" },
{ "src": "hello {|4.2| +num xx \\\\ b |3.14| r }" },
{ "src": "hello {$foo +num x \\\\ abcde |3.14| r }" },
{ "src": "hello {$foo >num x \\\\ abcde |aaa||3.14||42| r }" },
{ "src": "hello {$foo >num x \\\\ abcde |aaa||3.14| |42| r }" },
{ "src" : ".input{ $n ~ }{{{$n}}}" }
]
}
238 changes: 0 additions & 238 deletions test/tests/syntax.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,6 @@
"src": ".local $x ={a}.input{$y}{{}}",
"exp": ""
},
{
"description": "message -> complex-message -> *(declaration [s]) complex-body -> declaration complex-body -> reserved-statement complex-body -> reserved-keyword expression -> \".\" name expression complex-body",
"src": ".n{a}{{}}",
"exp": "",
"expErrors": [ { "type": "unsupported-statement" } ]
},
{
"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{{}}*{{}}",
Expand Down Expand Up @@ -304,18 +298,6 @@
"exp": "{:f}",
"expErrors": [{ "type": "unknown-function" }]
},
{
"description": "... annotation -> private-use-annotation -> private-start",
"src": "{^}",
"exp": "{^}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... annotation -> reserved-annotation -> reserved-annotation-start",
"src": "{!}",
"exp": "{!}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "message -> simple-message -> simple-start pattern -> placeholder -> markup -> \"{\" s \"#\" identifier \"}\"",
"src": "{ #a}",
Expand Down Expand Up @@ -507,114 +489,6 @@
"src": "{0E-1}",
"exp": "0E-1"
},
{
"description": "... reserved-statement -> reserved-keyword s reserved-body 1*([s] expression) -> reserved-keyword s reserved-body expression -> \".\" name s reserved-body-part expression -> \".\" name s reserved-char expression ...",
"src": ".n .{a}{{}}",
"exp": "",
"expErrors": [ { "type": "unsupported-statement" } ]
},
{
"description": "... reserved-statement -> reserved-keyword reserved-body 1*([s] expression) -> reserved-keyword s reserved-body s expression -> \".\" name s reserved-body-part expression -> \".\" name s reserved-char expression ...",
"src": ".n. {a}{{}}",
"exp": "",
"expErrors": [ { "type": "unsupported-statement" } ]
},
{
"description": "... reserved-statement -> reserved-keyword reserved-body 1*([s] expression) -> reserved-keyword reserved-body expression expression -> \".\" name reserved-body-part expression expression -> \".\" name s reserved-char expression expression ...",
"src": ".n.{a}{b}{{}}",
"exp": "",
"expErrors": [ { "type": "unsupported-statement" } ]
},
{
"description": "... reserved-annotation -> reserved-annotation-start reserved-body -> \"!\" reserved-body-part -> \"!\" reserved-char ...",
"src": "{!.}",
"exp": "{!}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... reserved-annotation -> reserved-annotation-start s reserved-body -> \"!\" s reserved-body-part -> \"!\" s reserved-char ...",
"src": "{! .}",
"exp": "{!}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... reserved-annotation-start ...",
"src": "{%}",
"exp": "{%}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... reserved-annotation-start ...",
"src": "{*}",
"exp": "{*}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... reserved-annotation-start ...",
"src": "{+}",
"exp": "{+}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... reserved-annotation-start ...",
"src": "{<}",
"exp": "{<}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... reserved-annotation-start ...",
"src": "{>}",
"exp": "{>}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... reserved-annotation-start ...",
"src": "{?}",
"exp": "{?}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... reserved-annotation-start ...",
"src": "{~}",
"exp": "{~}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... private-use-annotation -> private-start reserved-body -> \"^\" reserved-body-part -> \"^\" reserved-char ...",
"src": "{^.}",
"exp": "{^}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... private-use-annotation -> private-start s reserved-body -> \"^\" s reserved-body-part -> \"^\" s reserved-char ...",
"src": "{^ .}",
"exp": "{^}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... private-start ...",
"src": "{&}",
"exp": "{&}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... reserved-annotation -> reserved-annotation-start reserved-body -> \"!\" reserved-body-part reserved-body-part -> \"!\" reserved-char escaped-char ...",
"src": "{!.\\{}",
"exp": "{!}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... reserved-annotation -> reserved-annotation-start reserved-body -> \"!\" reserved-body-part s reserved-body-part -> \"!\" reserved-char s escaped-char ...",
"src": "{!. \\{}",
"exp": "{!}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"description": "... reserved-annotation -> reserved-annotation-start reserved-body -> \"!\" reserved-body-part -> \"!\" quoted-literal ...",
"src": "{!|a|}",
"exp": "{!}",
"expErrors": [{ "type": "unsupported-expression" }]
},
{
"src": "hello { world\t\n}",
"exp": "hello world"
Expand Down Expand Up @@ -820,118 +694,6 @@
}
]
},
{
"src": "foo {+reserved}",
"exp": "foo {+}",
"expParts": [
{
"type": "literal",
"value": "foo "
},
{
"type": "fallback",
"source": "+"
}
],
"expErrors": [
{
"type": "unsupported-expression"
}
]
},
{
"src": "foo {&private}",
"exp": "foo {&}",
"expParts": [
{
"type": "literal",
"value": "foo "
},
{
"type": "fallback",
"source": "&"
}
],
"expErrors": [
{
"type": "unsupported-expression"
}
]
},
{
"src": "foo {?reserved @a @b=c}",
"exp": "foo {?}",
"expParts": [
{
"type": "literal",
"value": "foo "
},
{
"type": "fallback",
"source": "?"
}
],
"expErrors": [
{
"type": "unsupported-expression"
}
]
},
{
"src": ".foo {42} {{bar}}",
"exp": "bar",
"expParts": [
{
"type": "literal",
"value": "bar"
}
],
"expErrors": [
{
"type": "unsupported-statement"
}
]
},
{
"src": ".foo{42}{{bar}}",
"exp": "bar",
"expParts": [
{
"type": "literal",
"value": "bar"
}
],
"expErrors": [
{
"type": "unsupported-statement"
}
]
},
{
"src": ".foo |}lit{| {42}{{bar}}",
"exp": "bar",
"expParts": [
{
"type": "literal",
"value": "bar"
}
],
"expErrors": [
{
"type": "unsupported-statement"
}
]
},
{
"src": ".l $y = {|bar|} {{}}",
"exp": "",
"expParts": [],
"expErrors": [
{
"type": "unsupported-statement"
}
]
},
{
"src": "{{trailing whitespace}} \n",
"exp": "trailing whitespace"
Expand Down
Loading

0 comments on commit ef280f8

Please sign in to comment.