| { |
| "date": [ |
| { "src": "{:date}", "exp": "{:date}", "errors": [{ "type": "bad-input" }] }, |
| { |
| "src": "{horse :date}", |
| "exp": "{|horse|}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { "src": "{|2006-01-02| :date}" }, |
| { "src": "{|2006-01-02T15:04:06| :date}" }, |
| { "src": "{|2006-01-02| :date style=long}" }, |
| { |
| "src": ".local $d = {|2006-01-02| :date style=long} {{{$d :date}}}" |
| }, |
| { |
| "src": ".local $t = {|2006-01-02T15:04:06| :time} {{{$t :date}}}" |
| } |
| ], |
| "time": [ |
| { "src": "{:time}", "exp": "{:time}", "errors": [{ "type": "bad-input" }] }, |
| { |
| "src": "{horse :time}", |
| "exp": "{|horse|}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { "src": "{|2006-01-02T15:04:06| :time}" }, |
| { |
| "src": "{|2006-01-02T15:04:06| :time style=medium}" |
| }, |
| { |
| "src": ".local $t = {|2006-01-02T15:04:06| :time style=medium} {{{$t :time}}}" |
| }, |
| { |
| "src": ".local $d = {|2006-01-02T15:04:06| :date} {{{$d :time}}}" |
| } |
| ], |
| "datetime": [ |
| { |
| "src": "{:datetime}", |
| "exp": "{:datetime}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { |
| "src": "{$x :datetime}", |
| "exp": "{$x}", |
| "params": { "x": true }, |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { |
| "src": "{horse :datetime}", |
| "exp": "{|horse|}", |
| "errors": [{ "name": "RangeError" }] |
| }, |
| { "src": "{|2006-01-02T15:04:06| :datetime}" }, |
| { |
| "src": "{|2006-01-02T15:04:06| :datetime year=numeric month=|2-digit|}" |
| }, |
| { |
| "src": "{|2006-01-02T15:04:06| :datetime dateStyle=long}" |
| }, |
| { |
| "src": "{|2006-01-02T15:04:06| :datetime timeStyle=medium}" |
| }, |
| { |
| "src": "{$dt :datetime}", |
| "params": { "dt": "2006-01-02T15:04:06" } |
| } |
| ], |
| "integer": [ |
| { "src": "hello {4.2 :integer}", "exp": "hello 4" }, |
| { "src": "hello {-4.20 :integer}", "exp": "hello -4" }, |
| { "src": "hello {0.42e+1 :integer}", "exp": "hello 4" }, |
| { |
| "src": ".match {$foo :integer} one {{one}} * {{other}}", |
| "params": { "foo": 1.2 }, |
| "exp": "one" |
| } |
| ], |
| "number": [ |
| { "src": "hello {4.2 :number}", "exp": "hello 4.2" }, |
| { "src": "hello {-4.20 :number}", "exp": "hello -4.2" }, |
| { "src": "hello {0.42e+1 :number}", "exp": "hello 4.2" }, |
| { |
| "src": "hello {foo :number}", |
| "exp": "hello {|foo|}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { |
| "src": "invalid number literal {.1 :number}", |
| "exp": "invalid number literal {|.1|}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { |
| "src": "invalid number literal {1. :number}", |
| "exp": "invalid number literal {|1.|}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { |
| "src": "invalid number literal {01 :number}", |
| "exp": "invalid number literal {|01|}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { |
| "src": "invalid number literal {|+1| :number}", |
| "exp": "invalid number literal {|+1|}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { |
| "src": "invalid number literal {0x1 :number}", |
| "exp": "invalid number literal {|0x1|}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { |
| "src": "hello {:number}", |
| "exp": "hello {:number}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { |
| "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=$foo}", |
| "params": { "foo": 2 }, |
| "exp": "hello 4.20" |
| }, |
| { |
| "src": "hello {|4.2| :number minimumFractionDigits=$foo}", |
| "params": { "foo": "2" }, |
| "exp": "hello 4.20" |
| }, |
| { |
| "src": ".local $foo = {$bar :number} {{bar {$foo}}}", |
| "params": { "bar": 4.2 }, |
| "exp": "bar 4.2" |
| }, |
| { |
| "src": ".local $foo = {$bar :number minimumFractionDigits=2} {{bar {$foo}}}", |
| "params": { "bar": 4.2 }, |
| "exp": "bar 4.20" |
| }, |
| { |
| "src": ".local $foo = {$bar :number minimumFractionDigits=foo} {{bar {$foo}}}", |
| "params": { "bar": 4.2 }, |
| "exp": "bar {$bar}", |
| "errors": [{ "type": "bad-option" }] |
| }, |
| { |
| "src": ".local $foo = {$bar :number} {{bar {$foo}}}", |
| "params": { "bar": "foo" }, |
| "exp": "bar {$bar}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { |
| "src": ".input {$foo :number} {{bar {$foo}}}", |
| "params": { "foo": 4.2 }, |
| "exp": "bar 4.2" |
| }, |
| { |
| "src": ".input {$foo :number minimumFractionDigits=2} {{bar {$foo}}}", |
| "params": { "foo": 4.2 }, |
| "exp": "bar 4.20" |
| }, |
| { |
| "src": ".input {$foo :number minimumFractionDigits=foo} {{bar {$foo}}}", |
| "params": { "foo": 4.2 }, |
| "exp": "bar {$foo}", |
| "errors": [{ "type": "bad-option" }] |
| }, |
| { |
| "src": ".input {$foo :number} {{bar {$foo}}}", |
| "params": { "foo": "foo" }, |
| "exp": "bar {$foo}", |
| "errors": [{ "type": "bad-input" }] |
| }, |
| { |
| "src": ".match {$foo :number} one {{one}} * {{other}}", |
| "params": { "foo": 1 }, |
| "exp": "one" |
| }, |
| { |
| "src": ".match {$foo :number} 1 {{=1}} one {{one}} * {{other}}", |
| "params": { "foo": 1 }, |
| "exp": "=1" |
| }, |
| { |
| "src": ".match {$foo :number} one {{one}} 1 {{=1}} * {{other}}", |
| "params": { "foo": 1 }, |
| "exp": "=1" |
| }, |
| { |
| "src": ".match {$foo :number} {$bar :number} one one {{one one}} one * {{one other}} * * {{other}}", |
| "params": { "foo": 1, "bar": 1 }, |
| "exp": "one one" |
| }, |
| { |
| "src": ".match {$foo :number} {$bar :number} one one {{one one}} one * {{one other}} * * {{other}}", |
| "params": { "foo": 1, "bar": 2 }, |
| "exp": "one other" |
| }, |
| { |
| "src": ".match {$foo :number} {$bar :number} one one {{one one}} one * {{one other}} * * {{other}}", |
| "params": { "foo": 2, "bar": 2 }, |
| "exp": "other" |
| }, |
| { |
| "src": ".input {$foo :number} .match {$foo} one {{one}} * {{other}}", |
| "params": { "foo": 1 }, |
| "exp": "one" |
| }, |
| { |
| "src": ".local $foo = {$bar :number} .match {$foo} one {{one}} * {{other}}", |
| "params": { "bar": 1 }, |
| "exp": "one" |
| }, |
| { |
| "src": ".input {$foo :number} .local $bar = {$foo} .match {$bar} one {{one}} * {{other}}", |
| "params": { "foo": 1 }, |
| "exp": "one" |
| }, |
| { |
| "src": ".input {$bar :number} .match {$bar} one {{one}} * {{other}}", |
| "params": { "bar": 2 }, |
| "exp": "other" |
| }, |
| { |
| "src": ".input {$bar} .match {$bar :number} one {{one}} * {{other}}", |
| "params": { "bar": 1 }, |
| "exp": "one" |
| }, |
| { |
| "src": ".input {$bar} .match {$bar :number} one {{one}} * {{other}}", |
| "params": { "bar": 2 }, |
| "exp": "other" |
| }, |
| { |
| "src": ".input {$bar} .match {$bar :number} one {{one}} * {{other}}", |
| "params": { "bar": 1 }, |
| "exp": "one" |
| }, |
| { |
| "src": ".input {$bar} .match {$bar :number} one {{one}} * {{other}}", |
| "params": { "bar": 2 }, |
| "exp": "other" |
| }, |
| { |
| "src": ".input {$none} .match {$foo :number} one {{one}} * {{{$none}}}", |
| "params": { "foo": 1 }, |
| "exp": "one" |
| }, |
| { |
| "src": ".local $bar = {$none} .match {$foo :number} one {{one}} * {{{$bar}}}", |
| "params": { "foo": 1 }, |
| "exp": "one" |
| }, |
| { |
| "src": ".local $bar = {$none} .match {$foo :number} one {{one}} * {{{$bar}}}", |
| "params": { "foo": 2 }, |
| "exp": "{$none}", |
| "errors": [{ "type": "unresolved-var" }] |
| }, |
| { |
| "src": "{42 :number @foo @bar=13}", |
| "exp": "42", |
| "parts": [ |
| { "type": "number", "parts": [{ "type": "integer", "value": "42" }] } |
| ] |
| } |
| ], |
| "ordinal": [ |
| { |
| "src": ".match {$foo :ordinal} one {{st}} two {{nd}} few {{rd}} * {{th}}", |
| "params": { "foo": 1 }, |
| "exp": "th", |
| "errors": [{ "type": "missing-func" }, { "type": "not-selectable" }] |
| }, |
| { |
| "src": "hello {42 :ordinal}", |
| "exp": "hello {|42|}", |
| "errors": [{ "type": "missing-func" }] |
| } |
| ], |
| "plural": [ |
| { |
| "src": ".match {$foo :plural} one {{one}} * {{other}}", |
| "params": { "foo": 1 }, |
| "exp": "other", |
| "errors": [{ "type": "missing-func" }, { "type": "not-selectable" }] |
| }, |
| { |
| "src": "hello {42 :plural}", |
| "exp": "hello {|42|}", |
| "errors": [{ "type": "missing-func" }] |
| } |
| ], |
| "string": [ |
| { |
| "src": ".match {$foo :string} |1| {{one}} * {{other}}", |
| "params": { "foo": "1" }, |
| "exp": "one" |
| }, |
| { |
| "src": ".match {$foo :string} 1 {{one}} * {{other}}", |
| "params": { "foo": 1 }, |
| "exp": "one" |
| }, |
| { |
| "src": ".match {$foo :string} 1 {{one}} * {{other}}", |
| "params": { "foo": null }, |
| "exp": "other" |
| }, |
| { |
| "src": ".match {$foo :string} 1 {{one}} * {{other}}", |
| "exp": "other", |
| "errors": [{ "type": "unresolved-var" }] |
| } |
| ] |
| } |