| { |
| "$schema": "https://raw.githubusercontent.com/unicode-org/message-format-wg/main/test/schemas/v0/tests.schema.json", |
| "scenario": "Integer function", |
| "description": "The built-in formatter for integers.", |
| "defaultTestProperties": { |
| "bidiIsolation": "none", |
| "locale": "en-US" |
| }, |
| "tests": [ |
| { |
| "src": "hello {4.2 :integer}", |
| "exp": "hello 4" |
| }, |
| { |
| "src": "hello {-4.20 :integer}", |
| "exp": "hello -4" |
| }, |
| { |
| "src": "hello {0.42 :integer}", |
| "exp": "hello 0" |
| }, |
| { |
| "src": "hello {|0.42e+1| :integer}", |
| "exp": "hello 4" |
| }, |
| { |
| "src": ".input {$foo :integer} .match $foo 1 {{=1}} * {{other}}", |
| "params": [{ "name": "foo", "value": 1.2 }], |
| "exp": "=1" |
| }, |
| { |
| "src": ".input {$foo :integer} .match $foo 1 {{=1}} one {{one}} * {{other}}", |
| "params": [{ "name": "foo", "value": 1.2 }], |
| "exp": "=1" |
| }, |
| { |
| "src": ".local $x = {1.25 :integer} .local $y = {$x :number} {{{$y}}}", |
| "exp": "1" |
| }, |
| { |
| "src": "literal select {1 :integer select=exact}", |
| "exp": "literal select 1" |
| }, |
| { |
| "src": ".local $bad = {exact} {{variable select {1 :integer select=$bad}}}", |
| "exp": "variable select 1", |
| "expErrors": [{ "type": "bad-option" }] |
| }, |
| { |
| "src": "variable select {1 :integer select=$bad}", |
| "params": [{ "name": "bad", "value": "exact" }], |
| "exp": "variable select 1", |
| "expErrors": [{ "type": "bad-option" }] |
| }, |
| { |
| "src": ".local $sel = {1 :integer select=exact} .match $sel 1 {{literal select {$sel}}} * {{OTHER}}", |
| "exp": "literal select 1" |
| }, |
| { |
| "src": ".local $sel = {1 :integer select=exact} .local $bad = {$sel :integer} .match $bad 1 {{ONE}} * {{operand select {$bad}}}", |
| "exp": "operand select 1", |
| "expErrors": [{ "type": "bad-option" }, { "type": "bad-selector" }] |
| }, |
| { |
| "src": ".local $sel = {1 :integer select=$bad} .match $sel 1 {{ONE}} * {{variable select {$sel}}}", |
| "params": [{ "name": "bad", "value": "exact" }], |
| "exp": "variable select 1", |
| "expErrors": [{ "type": "bad-option" }, { "type": "bad-selector" }] |
| } |
| ] |
| } |