Skip to content

Commit

Permalink
Fix #993, make expErrors array only (not boolean)
Browse files Browse the repository at this point in the history
  • Loading branch information
mihnita committed Jan 30, 2025
1 parent 04246c3 commit 8bb0b00
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 41 deletions.
10 changes: 1 addition & 9 deletions test/schemas/v0/tests.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,7 @@
},
"expErrors": {
"description": "The runtime errors expected to be emitted when formatting the message. If expErrors is either absent or empty, the message must be formatted without errors.",
"type": [
"array",
"boolean"
],
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
Expand Down Expand Up @@ -395,11 +392,6 @@
"required": [
"expParts"
]
},
{
"required": [
"expErrors"
]
}
]
}
Expand Down
27 changes: 17 additions & 10 deletions test/tests/fallback.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,56 @@
"description": "Test cases for fallback behaviour.",
"defaultTestProperties": {
"bidiIsolation": "none",
"locale": "en-US",
"expErrors": true
"locale": "en-US"
},
"tests": [
{
"description": "function with unquoted literal operand",
"src": "{42 :test:function fails=format}",
"exp": "{|42|}"
"exp": "{|42|}",
"expErrors": [{ "type": "unknown-function" }]
},
{
"description": "function with quoted literal operand",
"src": "{|C:\\\\| :test:function fails=format}",
"exp": "{|C:\\\\|}"
"exp": "{|C:\\\\|}",
"expErrors": [{ "type": "unknown-function" }]
},
{
"description": "unannotated implicit input variable",
"src": "{$var}",
"exp": "{$var}"
"exp": "{$var}",
"expErrors": [{ "type": "tbd-why-is-this-a-fallback" }]
},
{
"description": "annotated implicit input variable",
"src": "{$var :number}",
"exp": "{$var}"
"exp": "{$var}",
"expErrors": [{ "type": "tbd-why-is-this-a-fallback" }]
},
{
"description": "local variable with unknown function in declaration",
"src": ".local $var = {|val| :test:undefined} {{{$var}}}",
"exp": "{$var}"
"exp": "{$var}",
"expErrors": [{ "type": "unknown-function" }]
},
{
"description": "function with local variable operand with unknown function in declaration",
"src": ".local $var = {|val| :test:undefined} {{{$var :test:function}}}",
"exp": "{$var}"
"exp": "{$var}",
"expErrors": [{ "type": "unknown-function" }]
},
{
"description": "local variable with unknown function in placeholder",
"src": ".local $var = {|val|} {{{$var :test:undefined}}}",
"exp": "{$var}"
"exp": "{$var}",
"expErrors": [{ "type": "unknown-function" }]
},
{
"description": "function with no operand",
"src": "{:test:undefined}",
"exp": "{:test:undefined}"
"exp": "{:test:undefined}",
"expErrors": [{ "type": "bad-operand" }]
}
]
}
24 changes: 8 additions & 16 deletions test/tests/functions/currency.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,30 @@
"expErrors": [{ "type": "bad-operand" }]
},
{
"src": "{42 :currency currency=EUR}",
"expErrors": false
"src": "{42 :currency currency=EUR}"
},
{
"src": ".local $n = {42 :number} {{{$n :currency currency=EUR}}}",
"expErrors": false
"src": ".local $n = {42 :number} {{{$n :currency currency=EUR}}}"
},
{
"src": ".local $n = {42 :integer} {{{$n :currency currency=EUR}}}",
"expErrors": false
"src": ".local $n = {42 :integer} {{{$n :currency currency=EUR}}}"
},
{
"src": ".local $n = {42 :currency currency=EUR} {{{$n :currency}}}",
"expErrors": false
"src": ".local $n = {42 :currency currency=EUR} {{{$n :currency}}}"
},
{
"src": "{42 :currency currency=EUR fractionDigits=auto}",
"expErrors": false
"src": "{42 :currency currency=EUR fractionDigits=auto}"
},
{
"src": "{42 :currency currency=EUR fractionDigits=2}",
"expErrors": false
"src": "{42 :currency currency=EUR fractionDigits=2}"
},
{
"src": "{$x :currency currency=EUR}",
"params": [{ "name": "x", "value": 41 }],
"expErrors": false
"params": [{ "name": "x", "value": 41 }]
},
{
"src": ".local $n = {42 :currency currency=EUR} .match $n * {{other}}",
"exp": "other",
"expErrors": false
"exp": "other"
}
]
}
3 changes: 1 addition & 2 deletions test/tests/functions/date.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "The built-in formatter for dates.",
"defaultTestProperties": {
"bidiIsolation": "none",
"locale": "en-US",
"expErrors": false
"locale": "en-US"
},
"tests": [
{
Expand Down
3 changes: 1 addition & 2 deletions test/tests/functions/datetime.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "The built-in formatter for datetimes.",
"defaultTestProperties": {
"bidiIsolation": "none",
"locale": "en-US",
"expErrors": false
"locale": "en-US"
},
"tests": [
{
Expand Down
3 changes: 1 addition & 2 deletions test/tests/functions/time.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "The built-in formatter for times.",
"defaultTestProperties": {
"bidiIsolation": "none",
"locale": "en-US",
"expErrors": false
"locale": "en-US"
},
"tests": [
{
Expand Down

0 comments on commit 8bb0b00

Please sign in to comment.