mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-04 13:05:31 +00:00
Updating the spec tests requires two implementation changes: * Match on variables rather than expressions -- see https://github.com/unicode-org/message-format-wg/pull/877 * Require attribute values to be literals (if present) -- see https://github.com/unicode-org/message-format-wg/pull/894 This updates the spec tests to commit 6c3704f41a9c24427126429fb43992b03609dfc8 in https://github.com/unicode-org/message-format-wg/ . Any changes following that commit will be addressed in a future PR.
156 lines
7.5 KiB
JSON
156 lines
7.5 KiB
JSON
{
|
|
"scenario": "Valid tests",
|
|
"description": "Additional valid tests",
|
|
"defaultTestProperties": {
|
|
"locale": "en-US"
|
|
},
|
|
"tests": [
|
|
{ "src": "hello {|4.2| :number minimumFractionDigits=2}", "exp": "hello 4.20"},
|
|
{ "src": "hello {|4.2| :number minimumFractionDigits = 2}", "exp": "hello 4.20" },
|
|
{ "src": "hello {|4.2| :number minimumFractionDigits= 2}", "exp": "hello 4.20" },
|
|
{ "src": "hello {|4.2| :number minimumFractionDigits =2}", "exp": "hello 4.20"},
|
|
{ "src": "hello {|4.2| :number minimumFractionDigits=2 }", "exp": "hello 4.20"},
|
|
{ "src": "hello {|4.2| :number minimumFractionDigits=2 bar=3}", "exp": "hello 4.20"},
|
|
{ "src": "hello {|4.2| :number minimumFractionDigits=2 bar=3 }", "exp": "hello 4.20"},
|
|
{ "src": "hello {|4.2| :number minimumFractionDigits=|2|}", "exp": "hello 4.20"},
|
|
{ "src": "content -tag", "exp": "content -tag"},
|
|
{ "src": "", "exp": ""},
|
|
{ "src": "{|hel\\\\lo|}", "exp": "hel\\lo"},
|
|
{ "src": "{|hel\\|lo|}", "exp": "hel|lo"},
|
|
{ "src": "{|hel\\|\\\\lo|}", "exp": "hel|\\lo"},
|
|
{ "src": "hel\\{lo", "exp": "hel{lo"},
|
|
{ "src": "hel\\}lo", "exp": "hel}lo"},
|
|
{ "src": "hel\\\\lo", "exp": "hel\\lo"},
|
|
{ "src": "hel\\{\\\\lo", "exp": "hel{\\lo"},
|
|
{ "src": "hel\\{\\}lo", "exp": "hel{}lo"},
|
|
{ "src": "hello {|wo\nrld|}", "exp": "hello wo\nrld"},
|
|
{ "src": "hello wo\nrld", "exp": "hello wo\nrld"},
|
|
{ "src": "{#tag/} content", "exp": " content"},
|
|
{ "src": "{#tag} content", "exp": " content"},
|
|
{ "src": "{#tag/} {|content|}", "exp": " content"},
|
|
{ "src": "{#tag} {|content|}", "exp": " content"},
|
|
{ "src": "{|content|} {#tag/}", "exp": "content "},
|
|
{ "src": "{|content|} {#tag}", "exp": "content "},
|
|
{ "src": "{/tag} {|content|}", "exp": " content"},
|
|
{ "src": "{|content|} {/tag}", "exp": "content "},
|
|
{ "src": "{#tag} {|content|} {/tag}", "exp": " content "},
|
|
{ "src": "{/tag} {|content|} {#tag}", "exp": " content "},
|
|
{ "src": "{#tag/} {|content|} {#tag}", "exp": " content "},
|
|
{ "src": "{#tag/} {|content|} {/tag}", "exp": " content "},
|
|
{ "src": "{#tag foo=bar/} {|content|}", "exp": " content"},
|
|
{ "src": "{#tag foo=bar} {|content|}", "exp": " content"},
|
|
{ "src": "{/tag foo=bar} {|content|}", "exp": " content"},
|
|
{ "src": "{#tag foo=bar} {|content|} {/tag foo=bar}", "exp": " content "},
|
|
{ "src": "{/tag foo=bar} {|content|} {#tag foo=bar}", "exp": " content "},
|
|
{ "src": "{#tag foo=bar /} {|content|} {#tag foo=bar}", "exp": " content "},
|
|
{ "src": "{#tag foo=bar/} {|content|} {/tag foo=bar}", "exp": " content "},
|
|
{ "src": "The value is {horse @horse}.", "exp": "The value is horse."},
|
|
{ "src": "hello {|4.2| @number}", "exp": "hello 4.2"},
|
|
{ "src": "The value is {horse @horse=cool}.", "exp": "The value is horse."},
|
|
{ "src": "hello {|4.2| @number=5}", "exp": "hello 4.2"},
|
|
{ "src": "{-1}", "exp": "-1"},
|
|
{ "src": "{0}", "exp": "0"},
|
|
{ "src": "{0.0123}", "exp": "0.0123"},
|
|
{ "src": "{1.234e5}", "exp": "1.234e5",
|
|
"ignoreJava": "See ICU-22810"},
|
|
{ "src": "{1.234E5}", "exp": "1.234E5",
|
|
"ignoreJava": "See ICU-22810"},
|
|
{ "src": "{1.234E+5}", "exp": "1.234E+5",
|
|
"ignoreJava": "See ICU-22810"},
|
|
{ "src": "{1.234e-5}", "exp": "1.234e-5",
|
|
"ignoreJava": "See ICU-22810"},
|
|
{ "src": "{42e5}", "exp": "42e5",
|
|
"ignoreJava": "See ICU-22810"},
|
|
{ "src": "{42e0}", "exp": "42e0",
|
|
"ignoreJava": "See ICU-22810"},
|
|
{ "src": "{42e000}", "exp": "42e000",
|
|
"ignoreJava": "See ICU-22810"},
|
|
{ "src": "{42e369}", "exp": "42e369",
|
|
"ignoreJava": "See ICU-22810"},
|
|
{ "src": "hello {|3| :number }", "exp": "hello 3" },
|
|
{ "src": "{:foo}", "expErrors": [{ "type": "unknown-function" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": "{:foo }", "expErrors": [{ "type": "unknown-function" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": "{:foo }", "expErrors": [{ "type": "unknown-function" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": "{:foo k=v}", "expErrors": [{ "type": "unknown-function" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": "{:foo k=v }", "expErrors": [{ "type": "unknown-function" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": "{:foo k1=v1 k2=v2}", "expErrors": [{ "type": "unknown-function" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": "{:foo k1=v1 k2=v2 }", "expErrors": [{ "type": "unknown-function" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": "{|3.14| }", "exp": "3.14" },
|
|
{ "src": "{|3.14| }", "exp": "3.14" },
|
|
{ "src": "{|3.14| :number}", "exp": "3.14" },
|
|
{ "src": "{|3.14| :number }", "exp": "3.14" },
|
|
{ "src": "{$bar }", "expErrors": [{ "type": "unresolved-variable" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": "{$bar }", "expErrors": [{ "type": "unresolved-variable" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": "{$bar :foo}", "expErrors": [{ "type": "unresolved-variable" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": "{$bar :foo }", "expErrors": [{ "type": "unresolved-variable" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": "{$bar-foo}", "expErrors": [{ "type": "unresolved-variable" }],
|
|
"ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" },
|
|
{ "src": ".local $foo = {|hello|} .local $foo = {$foo} {{{$foo}}}",
|
|
"expErrors": [{ "type": "duplicate-declaration" }] },
|
|
{ "src": "good {placeholder}", "exp": "good placeholder" },
|
|
{
|
|
"src": "a\\\\qbc",
|
|
"exp": "a\\qbc",
|
|
"comment": "pattern -> escaped-char -> backslash backslash"
|
|
},
|
|
{
|
|
"comment": "message -> simple-message -> simple-start pattern -> escaped-char",
|
|
"src": "\\\\",
|
|
"exp": "\\"
|
|
},
|
|
{
|
|
"comment": "message -> simple-message -> simple-start pattern -> placeholder -> markup -> \"{\" s \"#\" identifier \"}\"",
|
|
"src": "{ #a}",
|
|
"exp": ""
|
|
},
|
|
{
|
|
"comment": "message -> simple-message -> simple-start pattern -> placeholder -> markup -> \"{\" s \"/\" identifier \"}\"",
|
|
"src": "{ /a}",
|
|
"exp": ""
|
|
},
|
|
{
|
|
"comment": "message -> complex-message -> *(declaration [s]) complex-body -> declaration complex-body -> input-declaration complex-body -> input variable-expression complex-body",
|
|
"src": ".input{$x}{{}}",
|
|
"exp": ""
|
|
},
|
|
{
|
|
"comment": "Test that escaped characters are re-escaped properly when serializing literals",
|
|
"src": "{|\\}|}",
|
|
"exp": "}"
|
|
},
|
|
{
|
|
"comment": "Test that escaped characters are re-escaped properly when serializing patterns",
|
|
"src": "\\|",
|
|
"exp": "|"
|
|
},
|
|
{
|
|
"comment": "Test that parser and serializer treat optionally-escaped characters consistently",
|
|
"src" : "{{{1}|}}",
|
|
"exp": "1|"
|
|
},
|
|
{
|
|
"comment": "Trailing whitespace after match is valid",
|
|
"src": ".local $x = {1 :string} .match $x * {{}} ",
|
|
"exp": ""
|
|
},
|
|
{
|
|
"src" : "",
|
|
"exp" : ""
|
|
},
|
|
{
|
|
"src" : "{{}}",
|
|
"exp" : ""
|
|
}
|
|
]
|
|
}
|