1{ 2 "date": [ 3 { "src": "{:date}", "exp": "{:date}", "errors": [{ "type": "bad-input" }] }, 4 { 5 "src": "{horse :date}", 6 "exp": "{|horse|}", 7 "errors": [{ "type": "bad-input" }] 8 }, 9 { "src": "{|2006-01-02| :date}" }, 10 { "src": "{|2006-01-02T15:04:06| :date}" }, 11 { "src": "{|2006-01-02| :date style=long}" }, 12 { 13 "src": ".local $d = {|2006-01-02| :date style=long} {{{$d :date}}}" 14 }, 15 { 16 "src": ".local $t = {|2006-01-02T15:04:06| :time} {{{$t :date}}}" 17 } 18 ], 19 "time": [ 20 { "src": "{:time}", "exp": "{:time}", "errors": [{ "type": "bad-input" }] }, 21 { 22 "src": "{horse :time}", 23 "exp": "{|horse|}", 24 "errors": [{ "type": "bad-input" }] 25 }, 26 { "src": "{|2006-01-02T15:04:06| :time}" }, 27 { 28 "src": "{|2006-01-02T15:04:06| :time style=medium}" 29 }, 30 { 31 "src": ".local $t = {|2006-01-02T15:04:06| :time style=medium} {{{$t :time}}}" 32 }, 33 { 34 "src": ".local $d = {|2006-01-02T15:04:06| :date} {{{$d :time}}}" 35 } 36 ], 37 "datetime": [ 38 { 39 "src": "{:datetime}", 40 "exp": "{:datetime}", 41 "errors": [{ "type": "bad-input" }] 42 }, 43 { 44 "src": "{$x :datetime}", 45 "exp": "{$x}", 46 "params": { "x": true }, 47 "errors": [{ "type": "bad-input" }] 48 }, 49 { 50 "src": "{horse :datetime}", 51 "exp": "{|horse|}", 52 "errors": [{ "name": "RangeError" }] 53 }, 54 { "src": "{|2006-01-02T15:04:06| :datetime}" }, 55 { 56 "src": "{|2006-01-02T15:04:06| :datetime year=numeric month=|2-digit|}" 57 }, 58 { 59 "src": "{|2006-01-02T15:04:06| :datetime dateStyle=long}" 60 }, 61 { 62 "src": "{|2006-01-02T15:04:06| :datetime timeStyle=medium}" 63 }, 64 { 65 "src": "{$dt :datetime}", 66 "params": { "dt": "2006-01-02T15:04:06" } 67 } 68 ], 69 "integer": [ 70 { "src": "hello {4.2 :integer}", "exp": "hello 4" }, 71 { "src": "hello {-4.20 :integer}", "exp": "hello -4" }, 72 { "src": "hello {0.42e+1 :integer}", "exp": "hello 4" }, 73 { 74 "src": ".match {$foo :integer} one {{one}} * {{other}}", 75 "params": { "foo": 1.2 }, 76 "exp": "one" 77 } 78 ], 79 "number": [ 80 { "src": "hello {4.2 :number}", "exp": "hello 4.2" }, 81 { "src": "hello {-4.20 :number}", "exp": "hello -4.2" }, 82 { "src": "hello {0.42e+1 :number}", "exp": "hello 4.2" }, 83 { 84 "src": "hello {foo :number}", 85 "exp": "hello {|foo|}", 86 "errors": [{ "type": "bad-input" }] 87 }, 88 { 89 "src": "invalid number literal {.1 :number}", 90 "exp": "invalid number literal {|.1|}", 91 "errors": [{ "type": "bad-input" }] 92 }, 93 { 94 "src": "invalid number literal {1. :number}", 95 "exp": "invalid number literal {|1.|}", 96 "errors": [{ "type": "bad-input" }] 97 }, 98 { 99 "src": "invalid number literal {01 :number}", 100 "exp": "invalid number literal {|01|}", 101 "errors": [{ "type": "bad-input" }] 102 }, 103 { 104 "src": "invalid number literal {|+1| :number}", 105 "exp": "invalid number literal {|+1|}", 106 "errors": [{ "type": "bad-input" }] 107 }, 108 { 109 "src": "invalid number literal {0x1 :number}", 110 "exp": "invalid number literal {|0x1|}", 111 "errors": [{ "type": "bad-input" }] 112 }, 113 { 114 "src": "hello {:number}", 115 "exp": "hello {:number}", 116 "errors": [{ "type": "bad-input" }] 117 }, 118 { 119 "src": "hello {4.2 :number minimumFractionDigits=2}", 120 "exp": "hello 4.20" 121 }, 122 { 123 "src": "hello {|4.2| :number minimumFractionDigits=|2|}", 124 "exp": "hello 4.20" 125 }, 126 { 127 "src": "hello {4.2 :number minimumFractionDigits=$foo}", 128 "params": { "foo": 2 }, 129 "exp": "hello 4.20" 130 }, 131 { 132 "src": "hello {|4.2| :number minimumFractionDigits=$foo}", 133 "params": { "foo": "2" }, 134 "exp": "hello 4.20" 135 }, 136 { 137 "src": ".local $foo = {$bar :number} {{bar {$foo}}}", 138 "params": { "bar": 4.2 }, 139 "exp": "bar 4.2" 140 }, 141 { 142 "src": ".local $foo = {$bar :number minimumFractionDigits=2} {{bar {$foo}}}", 143 "params": { "bar": 4.2 }, 144 "exp": "bar 4.20" 145 }, 146 { 147 "src": ".local $foo = {$bar :number minimumFractionDigits=foo} {{bar {$foo}}}", 148 "params": { "bar": 4.2 }, 149 "exp": "bar {$bar}", 150 "errors": [{ "type": "bad-option" }] 151 }, 152 { 153 "src": ".local $foo = {$bar :number} {{bar {$foo}}}", 154 "params": { "bar": "foo" }, 155 "exp": "bar {$bar}", 156 "errors": [{ "type": "bad-input" }] 157 }, 158 { 159 "src": ".input {$foo :number} {{bar {$foo}}}", 160 "params": { "foo": 4.2 }, 161 "exp": "bar 4.2" 162 }, 163 { 164 "src": ".input {$foo :number minimumFractionDigits=2} {{bar {$foo}}}", 165 "params": { "foo": 4.2 }, 166 "exp": "bar 4.20" 167 }, 168 { 169 "src": ".input {$foo :number minimumFractionDigits=foo} {{bar {$foo}}}", 170 "params": { "foo": 4.2 }, 171 "exp": "bar {$foo}", 172 "errors": [{ "type": "bad-option" }] 173 }, 174 { 175 "src": ".input {$foo :number} {{bar {$foo}}}", 176 "params": { "foo": "foo" }, 177 "exp": "bar {$foo}", 178 "errors": [{ "type": "bad-input" }] 179 }, 180 { 181 "src": ".match {$foo :number} one {{one}} * {{other}}", 182 "params": { "foo": 1 }, 183 "exp": "one" 184 }, 185 { 186 "src": ".match {$foo :number} 1 {{=1}} one {{one}} * {{other}}", 187 "params": { "foo": 1 }, 188 "exp": "=1" 189 }, 190 { 191 "src": ".match {$foo :number} one {{one}} 1 {{=1}} * {{other}}", 192 "params": { "foo": 1 }, 193 "exp": "=1" 194 }, 195 { 196 "src": ".match {$foo :number} {$bar :number} one one {{one one}} one * {{one other}} * * {{other}}", 197 "params": { "foo": 1, "bar": 1 }, 198 "exp": "one one" 199 }, 200 { 201 "src": ".match {$foo :number} {$bar :number} one one {{one one}} one * {{one other}} * * {{other}}", 202 "params": { "foo": 1, "bar": 2 }, 203 "exp": "one other" 204 }, 205 { 206 "src": ".match {$foo :number} {$bar :number} one one {{one one}} one * {{one other}} * * {{other}}", 207 "params": { "foo": 2, "bar": 2 }, 208 "exp": "other" 209 }, 210 { 211 "src": ".input {$foo :number} .match {$foo} one {{one}} * {{other}}", 212 "params": { "foo": 1 }, 213 "exp": "one" 214 }, 215 { 216 "src": ".local $foo = {$bar :number} .match {$foo} one {{one}} * {{other}}", 217 "params": { "bar": 1 }, 218 "exp": "one" 219 }, 220 { 221 "src": ".input {$foo :number} .local $bar = {$foo} .match {$bar} one {{one}} * {{other}}", 222 "params": { "foo": 1 }, 223 "exp": "one" 224 }, 225 { 226 "src": ".input {$bar :number} .match {$bar} one {{one}} * {{other}}", 227 "params": { "bar": 2 }, 228 "exp": "other" 229 }, 230 { 231 "src": ".input {$bar} .match {$bar :number} one {{one}} * {{other}}", 232 "params": { "bar": 1 }, 233 "exp": "one" 234 }, 235 { 236 "src": ".input {$bar} .match {$bar :number} one {{one}} * {{other}}", 237 "params": { "bar": 2 }, 238 "exp": "other" 239 }, 240 { 241 "src": ".input {$bar} .match {$bar :number} one {{one}} * {{other}}", 242 "params": { "bar": 1 }, 243 "exp": "one" 244 }, 245 { 246 "src": ".input {$bar} .match {$bar :number} one {{one}} * {{other}}", 247 "params": { "bar": 2 }, 248 "exp": "other" 249 }, 250 { 251 "src": ".input {$none} .match {$foo :number} one {{one}} * {{{$none}}}", 252 "params": { "foo": 1 }, 253 "exp": "one" 254 }, 255 { 256 "src": ".local $bar = {$none} .match {$foo :number} one {{one}} * {{{$bar}}}", 257 "params": { "foo": 1 }, 258 "exp": "one" 259 }, 260 { 261 "src": ".local $bar = {$none} .match {$foo :number} one {{one}} * {{{$bar}}}", 262 "params": { "foo": 2 }, 263 "exp": "{$none}", 264 "errors": [{ "type": "unresolved-var" }] 265 }, 266 { 267 "src": "{42 :number @foo @bar=13}", 268 "exp": "42", 269 "parts": [ 270 { "type": "number", "parts": [{ "type": "integer", "value": "42" }] } 271 ] 272 } 273 ], 274 "ordinal": [ 275 { 276 "src": ".match {$foo :ordinal} one {{st}} two {{nd}} few {{rd}} * {{th}}", 277 "params": { "foo": 1 }, 278 "exp": "th", 279 "errors": [{ "type": "missing-func" }, { "type": "not-selectable" }] 280 }, 281 { 282 "src": "hello {42 :ordinal}", 283 "exp": "hello {|42|}", 284 "errors": [{ "type": "missing-func" }] 285 } 286 ], 287 "plural": [ 288 { 289 "src": ".match {$foo :plural} one {{one}} * {{other}}", 290 "params": { "foo": 1 }, 291 "exp": "other", 292 "errors": [{ "type": "missing-func" }, { "type": "not-selectable" }] 293 }, 294 { 295 "src": "hello {42 :plural}", 296 "exp": "hello {|42|}", 297 "errors": [{ "type": "missing-func" }] 298 } 299 ], 300 "string": [ 301 { 302 "src": ".match {$foo :string} |1| {{one}} * {{other}}", 303 "params": { "foo": "1" }, 304 "exp": "one" 305 }, 306 { 307 "src": ".match {$foo :string} 1 {{one}} * {{other}}", 308 "params": { "foo": 1 }, 309 "exp": "one" 310 }, 311 { 312 "src": ".match {$foo :string} 1 {{one}} * {{other}}", 313 "params": { "foo": null }, 314 "exp": "other" 315 }, 316 { 317 "src": ".match {$foo :string} 1 {{one}} * {{other}}", 318 "exp": "other", 319 "errors": [{ "type": "unresolved-var" }] 320 } 321 ] 322} 323