-
-
Notifications
You must be signed in to change notification settings - Fork 35
Description
In spec/bidi.json we have these tests:
{
"description": "complex-message = o *(declaration o) complex-body o",
"src": ".local $x = {1} \u200F {{ {$x}}}",
"exp": " \u20681\u2069"
},
...
{
"description": "function-expression = \"{\" o function *(s attribute) o \"}\"",
"src": "{1 \u200E :number \u200F}",
"exp": "1"
},They look like the same test to me, but they expect different results.
Why I think that they are technically the same test:
- The bidi control characters in between parsed elements (sprinkled with the spaces for proper rendering)
have no effect on functionality.
So the two sources become:
"src": ".local $x = {1} {{ {$x}}}",
"src": "{1 :number}",Both format the value 1 from a number literal.
- We did allow implementations to use the proper function for a type.
So if I pass a date, the implied function will be :dateformat.
For a number literal, the most intuitive implied function would be :number
So formatting {1} and {1 :number} is the same.
Since the input of the test is virtually the same, we should expect the same result.
One might say "no, {1} is not the same as {1 :number}, because 1 in is a string, so the associated method is :string.
Also, rendering {1} as if the function is :string has no useful functionality.
It means we know the string to format in advance, at compile time.
At we render it "as is".
So there is no point to put it in a placeholder to begin with.
I know we don't have in the spec anything about what how to determine default functions.
But if everything is a string, and everything goes to :string, the whole expression with string literal without function becomes a lot less useful.
And having such a test in official test suite, even if not specified anywhere, prevents implementations from doing better.