-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix fallback value definition and use (#903)
* Fix references to fallback values * Apply suggestions from code review Co-authored-by: Addison Phillips <[email protected]> * Apply suggestions from code review Co-authored-by: Tim Chevalier <[email protected]> * Apply suggestions from code review Co-authored-by: Richard Gibson <[email protected]> * Typo fix * Note that operand options are not handled by Option Resolution * Apply suggestions from code review * Fix typo Co-authored-by: Tim Chevalier <[email protected]> * Use last rather than earliest operand for fallback value * Use last name also during fallback in variable resolution * Add tests for fallback formatting * Tighten up language about fallback values, their string representations, and options * Add "if supported" qualifier to emitting Bad Option error during option resolution Co-authored-by: Addison Phillips <[email protected]> --------- Co-authored-by: Addison Phillips <[email protected]> Co-authored-by: Tim Chevalier <[email protected]> Co-authored-by: Richard Gibson <[email protected]>
- Loading branch information
1 parent
852c5e2
commit f3344b5
Showing
3 changed files
with
131 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/unicode-org/message-format-wg/main/test/schemas/v0/tests.schema.json", | ||
"scenario": "Fallback", | ||
"description": "Test cases for fallback behaviour.", | ||
"defaultTestProperties": { | ||
"bidiIsolation": "none", | ||
"locale": "en-US", | ||
"expErrors": true | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "function with unquoted literal operand", | ||
"src": "{42 :test:function fails=format}", | ||
"exp": "{|42|}" | ||
}, | ||
{ | ||
"description": "function with quoted literal operand", | ||
"src": "{|C:\\\\| :test:function fails=format}", | ||
"exp": "{|C:\\\\|}" | ||
}, | ||
{ | ||
"description": "unannotated implicit input variable", | ||
"src": "{$var}", | ||
"exp": "{$var}" | ||
}, | ||
{ | ||
"description": "annotated implicit input variable", | ||
"src": "{$var :number}", | ||
"exp": "{$var}" | ||
}, | ||
{ | ||
"description": "local variable with unknown function in declaration", | ||
"src": ".local $var = {|val| :test:undefined} {{{$var}}}", | ||
"exp": "{$var}" | ||
}, | ||
{ | ||
"description": "function with local variable operand with unknown function in declaration", | ||
"src": ".local $var = {|val| :test:undefined} {{{$var :test:function}}}", | ||
"exp": "{$var}" | ||
}, | ||
{ | ||
"description": "local variable with unknown function in placeholder", | ||
"src": ".local $var = {|val|} {{{$var :test:undefined}}}", | ||
"exp": "{$var}" | ||
}, | ||
{ | ||
"description": "function with no operand", | ||
"src": "{:test:undefined}", | ||
"exp": "{:test:undefined}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters