-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix tests for bidirectional isolation #917
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
"scenario": "Bidi support", | ||
"description": "Tests for correct parsing of messages with bidirectional marks and isolates", | ||
"defaultTestProperties": { | ||
"bidiIsolation": "default", | ||
"locale": "en-US" | ||
}, | ||
"tests": [ | ||
|
@@ -13,17 +14,17 @@ | |
{ | ||
"description": "complex-message = o *(declaration o) complex-body o", | ||
"src": "\u200E .local $x = {1} {{ {$x}}}", | ||
"exp": " 1" | ||
"exp": " \u20681\u2069" | ||
}, | ||
{ | ||
"description": "complex-message = o *(declaration o) complex-body o", | ||
"src": ".local $x = {1} \u200F {{ {$x}}}", | ||
"exp": " 1" | ||
"exp": " \u20681\u2069" | ||
}, | ||
{ | ||
"description": "complex-message = o *(declaration o) complex-body o", | ||
"src": ".local $x = {1} {{ {$x}}} \u2066", | ||
"exp": " 1" | ||
"exp": " \u20681\u2069" | ||
}, | ||
{ | ||
"description": "input-declaration = input o variable-expression", | ||
|
@@ -79,12 +80,12 @@ | |
{ | ||
"description": "literal-expression = \"{\" o literal [s function] *(s attribute) o \"}\"", | ||
"src": "{\u200E hello \u200F}", | ||
"exp": "hello" | ||
"exp": "\u2068hello\u2069" | ||
}, | ||
{ | ||
"description": "variable-expression = \"{\" o variable [s function] *(s attribute) o \"}\"", | ||
"src": ".local $x = {1} {{ {\u200E $x \u200F} }}", | ||
"exp": " 1 " | ||
"exp": " \u20681\u2069 " | ||
}, | ||
{ | ||
"description": "function-expression = \"{\" o function *(s attribute) o \"}\"", | ||
|
@@ -114,7 +115,7 @@ | |
{ | ||
"description": " name... excludes U+FFFD and U+061C -- this pases as name -> [bidi] name-start *name-char", | ||
"src": ".local $\u061Cfoo = {1} {{ {$\u061Cfoo} }}", | ||
"exp": " 1 " | ||
"exp": " \u20681\u2069 " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess in this case, the direction of the message is determined to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bidi controls in the syntax source don't matter here at all, and the message has LTR direction because of the This is much the same thing as I mention in #917 (comment), but for LTR instead of RTL content.
Good point. We may want to add a mention under Formatting Context about deducing the message direction from the locale if it's not explicitly given. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If not explicitly provided, the direction of the message should be computed from the locale. As @eemeli notes, controls in the source don't matter. As noted elsewhere, you can't just look at the rendered placeholder to determine its desired direction--even strongly directional characters do not necessarily provide an accurate signal. |
||
}, | ||
{ | ||
"description": " name matches https://www.w3.org/TR/REC-xml-names/#NT-NCName but excludes U+FFFD and U+061C", | ||
|
@@ -124,17 +125,17 @@ | |
{ | ||
"description": "name = [bidi] name-start *name-char [bidi]", | ||
"src": ".local $\u200Efoo\u200F = {3} {{{$\u200Efoo\u200F}}}", | ||
"exp": "3" | ||
"exp": "\u20683\u2069" | ||
}, | ||
{ | ||
"description": "name = [bidi] name-start *name-char [bidi]", | ||
"src": ".local $foo = {4} {{{$\u200Efoo\u200F}}}", | ||
"exp": "4" | ||
"exp": "\u20684\u2069" | ||
}, | ||
{ | ||
"description": "name = [bidi] name-start *name-char [bidi]", | ||
"src": ".local $\u200Efoo\u200F = {5} {{{$foo}}}", | ||
"exp": "5" | ||
"exp": "\u20685\u2069" | ||
}, | ||
{ | ||
"description": "name = [bidi] name-start *name-char [bidi]", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
"scenario": "u: Options", | ||
"description": "Common options affecting the function context", | ||
"defaultTestProperties": { | ||
"bidiIsolation": "default", | ||
"locale": "en-US" | ||
}, | ||
"tests": [ | ||
|
@@ -24,7 +25,7 @@ | |
"type": "markup", | ||
"kind": "close", | ||
"id": "x", | ||
"name": "tag" | ||
"name": "ns:tag" | ||
} | ||
] | ||
}, | ||
|
@@ -45,7 +46,7 @@ | |
{ | ||
"type": "markup", | ||
"kind": "close", | ||
"name": "tag" | ||
"name": "ns:tag" | ||
} | ||
] | ||
}, | ||
|
@@ -74,32 +75,31 @@ | |
"src": "hello {world :string u:dir=rtl}", | ||
"exp": "hello \u2067world\u2069", | ||
"expParts": [ | ||
{ | ||
"type": "literal", | ||
"value": "hello " | ||
}, | ||
{ "type": "literal", "value": "hello " }, | ||
{ "type": "bidiIsolation", "value": "\u2067" }, | ||
{ | ||
"type": "string", | ||
"source": "|world|", | ||
"dir": "rtl", | ||
"locale": "en-US", | ||
"value": "world" | ||
} | ||
}, | ||
{ "type": "bidiIsolation", "value": "\u2069" } | ||
] | ||
}, | ||
{ | ||
"src": "hello {world :string u:dir=auto}", | ||
"exp": "hello \u2068world\u2069", | ||
"expParts": [ | ||
{ | ||
"type": "literal", | ||
"value": "hello " | ||
}, | ||
{ "type": "literal", "value": "hello " }, | ||
{ "type": "bidiIsolation", "value": "\u2068" }, | ||
{ | ||
"type": "string", | ||
"source": "|world|", | ||
"dir": "auto", | ||
"locale": "en-US", | ||
"value": "world" | ||
} | ||
}, | ||
{ "type": "bidiIsolation", "value": "\u2069" } | ||
] | ||
}, | ||
{ | ||
|
@@ -120,7 +120,7 @@ | |
{ | ||
"locale": "ar", | ||
"src": "أهلاً {بالعالم :string}", | ||
"exp": "أهلاً \u2067بالعالم\u2069" | ||
"exp": "أهلاً \u2068بالعالم\u2069" | ||
} | ||
Comment on lines
120
to
124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may need to drop this test, or more explicitly define whether Presuming that the introspection would follow UAX#9, the user's perception of the results would be the same, so my preference would be to make the character-level output predictable by requiring that no introspection is done in the absence of a |
||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/unicode-org/conformance/blob/main/schema/message_fmt2/testgen_schema.json will need to be updated to reflect this change.