Skip to content

Commit 313bc38

Browse files
authored
Fix tests for bidirectional isolation (#917)
1 parent 2a28704 commit 313bc38

File tree

10 files changed

+58
-23
lines changed

10 files changed

+58
-23
lines changed

test/schemas/v0/tests.schema.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@
118118
"src": {
119119
"$ref": "#/$defs/src"
120120
},
121+
"bidiIsolation": {
122+
"$ref": "#/$defs/bidiIsolation"
123+
},
121124
"params": {
122125
"$ref": "#/$defs/params"
123126
},
@@ -146,6 +149,9 @@
146149
"src": {
147150
"$ref": "#/$defs/src"
148151
},
152+
"bidiIsolation": {
153+
"$ref": "#/$defs/bidiIsolation"
154+
},
149155
"params": {
150156
"$ref": "#/$defs/params"
151157
},
@@ -172,6 +178,10 @@
172178
"description": "The MF2 syntax source.",
173179
"type": "string"
174180
},
181+
"bidiIsolation": {
182+
"description": "The bidi isolation strategy.",
183+
"enum": ["default", "none"]
184+
},
175185
"params": {
176186
"description": "Parameters to pass in to the formatter for resolving external variables.",
177187
"type": "array",
@@ -243,6 +253,23 @@
243253
}
244254
}
245255
},
256+
{
257+
"description": "Bidi isolation part.",
258+
"type": "object",
259+
"additionalProperties": false,
260+
"required": [
261+
"type",
262+
"value"
263+
],
264+
"properties": {
265+
"type": {
266+
"const": "bidiIsolation"
267+
},
268+
"value": {
269+
"enum": ["\u2066", "\u2067", "\u2068", "\u2069"]
270+
}
271+
}
272+
},
246273
{
247274
"description": "Message markup part.",
248275
"type": "object",

test/tests/bidi.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"scenario": "Bidi support",
33
"description": "Tests for correct parsing of messages with bidirectional marks and isolates",
44
"defaultTestProperties": {
5+
"bidiIsolation": "default",
56
"locale": "en-US"
67
},
78
"tests": [
@@ -13,17 +14,17 @@
1314
{
1415
"description": "complex-message = o *(declaration o) complex-body o",
1516
"src": "\u200E .local $x = {1} {{ {$x}}}",
16-
"exp": " 1"
17+
"exp": " \u20681\u2069"
1718
},
1819
{
1920
"description": "complex-message = o *(declaration o) complex-body o",
2021
"src": ".local $x = {1} \u200F {{ {$x}}}",
21-
"exp": " 1"
22+
"exp": " \u20681\u2069"
2223
},
2324
{
2425
"description": "complex-message = o *(declaration o) complex-body o",
2526
"src": ".local $x = {1} {{ {$x}}} \u2066",
26-
"exp": " 1"
27+
"exp": " \u20681\u2069"
2728
},
2829
{
2930
"description": "input-declaration = input o variable-expression",
@@ -79,12 +80,12 @@
7980
{
8081
"description": "literal-expression = \"{\" o literal [s function] *(s attribute) o \"}\"",
8182
"src": "{\u200E hello \u200F}",
82-
"exp": "hello"
83+
"exp": "\u2068hello\u2069"
8384
},
8485
{
8586
"description": "variable-expression = \"{\" o variable [s function] *(s attribute) o \"}\"",
8687
"src": ".local $x = {1} {{ {\u200E $x \u200F} }}",
87-
"exp": " 1 "
88+
"exp": " \u20681\u2069 "
8889
},
8990
{
9091
"description": "function-expression = \"{\" o function *(s attribute) o \"}\"",
@@ -114,7 +115,7 @@
114115
{
115116
"description": " name... excludes U+FFFD and U+061C -- this pases as name -> [bidi] name-start *name-char",
116117
"src": ".local $\u061Cfoo = {1} {{ {$\u061Cfoo} }}",
117-
"exp": " 1 "
118+
"exp": " \u20681\u2069 "
118119
},
119120
{
120121
"description": " name matches https://www.w3.org/TR/REC-xml-names/#NT-NCName but excludes U+FFFD and U+061C",
@@ -124,17 +125,17 @@
124125
{
125126
"description": "name = [bidi] name-start *name-char [bidi]",
126127
"src": ".local $\u200Efoo\u200F = {3} {{{$\u200Efoo\u200F}}}",
127-
"exp": "3"
128+
"exp": "\u20683\u2069"
128129
},
129130
{
130131
"description": "name = [bidi] name-start *name-char [bidi]",
131132
"src": ".local $foo = {4} {{{$\u200Efoo\u200F}}}",
132-
"exp": "4"
133+
"exp": "\u20684\u2069"
133134
},
134135
{
135136
"description": "name = [bidi] name-start *name-char [bidi]",
136137
"src": ".local $\u200Efoo\u200F = {5} {{{$foo}}}",
137-
"exp": "5"
138+
"exp": "\u20685\u2069"
138139
},
139140
{
140141
"description": "name = [bidi] name-start *name-char [bidi]",

test/tests/functions/date.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"scenario": "Date function",
44
"description": "The built-in formatter for dates.",
55
"defaultTestProperties": {
6+
"bidiIsolation": "none",
67
"locale": "en-US",
78
"expErrors": false
89
},

test/tests/functions/datetime.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"scenario": "Datetime function",
44
"description": "The built-in formatter for datetimes.",
55
"defaultTestProperties": {
6+
"bidiIsolation": "none",
67
"locale": "en-US",
78
"expErrors": false
89
},

test/tests/functions/integer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"scenario": "Integer function",
44
"description": "The built-in formatter for integers.",
55
"defaultTestProperties": {
6+
"bidiIsolation": "none",
67
"locale": "en-US"
78
},
89
"tests": [

test/tests/functions/number.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"scenario": "Number function",
44
"description": "The built-in formatter for numbers.",
55
"defaultTestProperties": {
6+
"bidiIsolation": "none",
67
"locale": "en-US"
78
},
89
"tests": [

test/tests/functions/string.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"scenario": "String function",
44
"description": "The built-in formatter for strings.",
55
"defaultTestProperties": {
6+
"bidiIsolation": "none",
67
"locale": "en-US"
78
},
89
"tests": [

test/tests/functions/time.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"scenario": "Time function",
44
"description": "The built-in formatter for times.",
55
"defaultTestProperties": {
6+
"bidiIsolation": "none",
67
"locale": "en-US",
78
"expErrors": false
89
},

test/tests/syntax.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"scenario": "Syntax",
44
"description": "Test cases that do not depend on any registry definitions.",
55
"defaultTestProperties": {
6+
"bidiIsolation": "none",
67
"locale": "en-US"
78
},
89
"tests": [

test/tests/u-options.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"scenario": "u: Options",
44
"description": "Common options affecting the function context",
55
"defaultTestProperties": {
6+
"bidiIsolation": "default",
67
"locale": "en-US"
78
},
89
"tests": [
@@ -24,7 +25,7 @@
2425
"type": "markup",
2526
"kind": "close",
2627
"id": "x",
27-
"name": "tag"
28+
"name": "ns:tag"
2829
}
2930
]
3031
},
@@ -45,7 +46,7 @@
4546
{
4647
"type": "markup",
4748
"kind": "close",
48-
"name": "tag"
49+
"name": "ns:tag"
4950
}
5051
]
5152
},
@@ -74,32 +75,31 @@
7475
"src": "hello {world :string u:dir=rtl}",
7576
"exp": "hello \u2067world\u2069",
7677
"expParts": [
77-
{
78-
"type": "literal",
79-
"value": "hello "
80-
},
78+
{ "type": "literal", "value": "hello " },
79+
{ "type": "bidiIsolation", "value": "\u2067" },
8180
{
8281
"type": "string",
8382
"source": "|world|",
8483
"dir": "rtl",
84+
"locale": "en-US",
8585
"value": "world"
86-
}
86+
},
87+
{ "type": "bidiIsolation", "value": "\u2069" }
8788
]
8889
},
8990
{
9091
"src": "hello {world :string u:dir=auto}",
9192
"exp": "hello \u2068world\u2069",
9293
"expParts": [
93-
{
94-
"type": "literal",
95-
"value": "hello "
96-
},
94+
{ "type": "literal", "value": "hello " },
95+
{ "type": "bidiIsolation", "value": "\u2068" },
9796
{
9897
"type": "string",
9998
"source": "|world|",
100-
"dir": "auto",
99+
"locale": "en-US",
101100
"value": "world"
102-
}
101+
},
102+
{ "type": "bidiIsolation", "value": "\u2069" }
103103
]
104104
},
105105
{
@@ -120,7 +120,7 @@
120120
{
121121
"locale": "ar",
122122
"src": "أهلاً {بالعالم :string}",
123-
"exp": "أهلاً \u2067بالعالم\u2069"
123+
"exp": "أهلاً \u2068بالعالم\u2069"
124124
}
125125
]
126126
}

0 commit comments

Comments
 (0)