Skip to content

Commit 9e59062

Browse files
authored
Add tests for :currency (#940)
* Add tests for :currency * Apply suggestions from code review * Update test/tests/functions/currency.json
1 parent 9f78316 commit 9e59062

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

test/tests/functions/currency.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/unicode-org/message-format-wg/main/test/schemas/v0/tests.schema.json",
3+
"scenario": "Currency function",
4+
"description": "The built-in formatter and selector for currencies.",
5+
"defaultTestProperties": {
6+
"bidiIsolation": "none",
7+
"locale": "en-US"
8+
},
9+
"tests": [
10+
{
11+
"src": "{:currency}",
12+
"expErrors": [{ "type": "bad-operand" }]
13+
},
14+
{
15+
"src": "{foo :currency}",
16+
"expErrors": [{ "type": "bad-operand" }]
17+
},
18+
{
19+
"src": "{42 :currency}",
20+
"expErrors": [{ "type": "bad-operand" }]
21+
},
22+
{
23+
"src": ".local $n = {42 :number} {{{$n :currency}}}",
24+
"expErrors": [{ "type": "bad-operand" }]
25+
},
26+
{
27+
"src": "{42 :currency currency=EUR}",
28+
"expErrors": false
29+
},
30+
{
31+
"src": ".local $n = {42 :number} {{{$n :currency currency=EUR}}}",
32+
"expErrors": false
33+
},
34+
{
35+
"src": ".local $n = {42 :integer} {{{$n :currency currency=EUR}}}",
36+
"expErrors": false
37+
},
38+
{
39+
"src": ".local $n = {42 :currency currency=EUR} {{{$n :currency}}}",
40+
"expErrors": false
41+
},
42+
{
43+
"src": "{42 :currency currency=EUR fractionDigits=auto}",
44+
"expErrors": false
45+
},
46+
{
47+
"src": "{42 :currency currency=EUR fractionDigits=2}",
48+
"expErrors": false
49+
},
50+
{
51+
"src": "{$x :currency currency=EUR}",
52+
"params": [{ "name": "x", "value": 41 }],
53+
"expErrors": false
54+
},
55+
{
56+
"src": ".local $n = {42 :currency currency=EUR} .match $n * {{other}}",
57+
"exp": "other",
58+
"expErrors": false
59+
}
60+
]
61+
}

0 commit comments

Comments
 (0)