| { |
| "scenario": "Tests from original ICU4J release", |
| "description": "Tests taken from the September 2022 MF2 ICU4J release", |
| "defaultTestProperties": { |
| "locale": "en-US" |
| }, |
| "tests": [ |
| { |
| "src": "hello {|4.2| :number}", |
| "exp": "hello 4.2" |
| }, |
| { |
| "locale": "ar-EG", |
| "src": "hello {|4.2| :number}", |
| "exp": "hello \u0664\u066B\u0662" |
| }, |
| { |
| "comment": "This is not an error! foo is not used before the local declaration, so the local declaration of $foo shadows the input variable.", |
| "src": ".local $foo = {bar} {{bar {$foo}}}", |
| "exp": "bar bar", |
| "params": [{ "name": "foo", "value": "foo" }] |
| }, |
| { |
| "src": ".local $foo = {$bar :number} {{bar {$foo}}}", |
| "params": [{ "name": "bar", "value": 4.2 }], |
| "exp": "bar 4.2" |
| }, |
| { |
| "src": ".local $bar = {$baz} .local $foo = {$bar} {{bar {$foo}}}", |
| "params": [{ "name": "baz", "value": "foo" }], |
| "exp": "bar foo" |
| }, |
| { |
| "src": ".input {$foo :number} .match $foo 1 {{one}} * {{other}}", |
| "params": [{ "name": "foo", "value": "1" }], |
| "exp": "one", |
| "ignoreJava": "See ICU-22809" |
| }, |
| { |
| "src": ".input {$foo :string} .match $foo 1 {{one}} * {{other}}", |
| "params": [{ "name": "foo", "value": "1" }], |
| "exp": "one" |
| }, |
| { |
| "src": ".input {$foo :number} .match $foo 1 {{one}} * {{other}}", |
| "params": [{ "name": "foo", "value": 1 }], |
| "exp": "one" |
| }, |
| { |
| "ignoreJava": "Can't pass null in a map", |
| "ignoreCpp": "Same as Java", |
| "src": ".match $foo 1 {{one}} * {{other}}", |
| "params": [{ "name": "foo", "value": null }], |
| "exp": "other" |
| }, |
| { |
| "src": ".input {$foo :number} .match $foo 1 {{one}} * {{other}}", |
| "exp": "other", |
| "expErrors": [{ "type": "unresolved-variable" }] |
| }, |
| { |
| "src": ".local $foo = {$bar :number} .match $foo one {{one}} * {{other}}", |
| "params": [{ "name": "bar", "value": 1 }], |
| "exp": "one" |
| }, |
| { |
| "src": ".local $foo = {$bar :number} .match $foo one {{one}} * {{other}}", |
| "params": [{ "name": "bar", "value": 2 }], |
| "exp": "other" |
| }, |
| { |
| "src": ".local $bar = {$none} .input {$foo :number} .match $foo one {{one}} * {{{$bar}}}", |
| "params": [{ "name": "foo", "value": 1 }, {"name": "none", "value": "" }], |
| "exp": "one" |
| }, |
| { |
| "src": ".local $bar = {$none :number} .input {$foo :string} .match $foo one {{one}} * {{{$bar}}}", |
| "params": [{ "name": "foo", "value": 2 }], |
| "exp": "{$none}", |
| "expErrors": [{ "type": "unresolved-variable" }], |
| "ignoreJava": "See https://github.com/unicode-org/message-format-wg/issues/782" |
| }, |
| { |
| "src": "{{#tag}}", |
| "exp": "#tag" |
| }, |
| { |
| "src": "{#tag}content{/tag}", |
| "exp": "content" |
| }, |
| { |
| "src": "{#tag foo=foo bar=$bar}", |
| "params": [{ "name": "bar", "value": "b a r" }], |
| "exp": "" |
| }, |
| { |
| "src": "bad {#markup/} test", |
| "exp": "bad test" |
| }, |
| { |
| "src": "no braces {$foo}", |
| "params": [{ "name": "foo", "value": 2 }], |
| "exp": "no braces 2" |
| }, |
| { |
| "src": "empty { }", |
| "expErrors": [{ "type": "syntax-error" }] |
| }, |
| { |
| "src": "bad {:}", |
| "exp": "bad {:}", |
| "expErrors": [{ "type": "syntax-error" }, { "type": "unknown-function" }] |
| }, |
| { |
| "src": "{bad {$placeholder option}}", |
| "expErrors": [{ "type": "syntax-error"}, { "type": "unresolved-variable" }] |
| }, |
| { |
| "src": ".local $f = {|foo| :string} .match $f *{{foo}}", |
| "exp": "foo" |
| }, |
| { |
| "src": ".input {$foo :string} .match $foo * * {{foo}}", |
| "expErrors": [{ "type": "variant-key-mismatch" }, { "type": "unresolved-variable" }] |
| }, |
| { |
| "src": ".input {$foo :string} .input {$bar :string} .match $foo $bar * {{foo}}", |
| "expErrors": [{ "type": "variant-key-mismatch" }, { "type": "unresolved-variable" }] |
| } |
| ] |
| } |