Skip to content

Commit 9c40277

Browse files
authored
Add test tags, initially for u: options (#1050)
* Add test tags, initially for u: options * Add documentation for test tags
1 parent 9652481 commit 9c40277

File tree

3 files changed

+59
-24
lines changed

3 files changed

+59
-24
lines changed

test/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ is not included in the schema,
5050
as it is intended to be an umbrella category
5151
for implementation-specific errors.
5252

53+
## Test Tags
54+
55+
Some of the tests are for functionality that is not stable,
56+
i.e. is marked RECOMMENDED, OPTIONAL, or DRAFT.
57+
Tests for such features have a `tags` array attached to them
58+
to mark the features that they rely on.
59+
This may include one or more of the following:
60+
61+
| Tag | Feature |
62+
| ---------- | ----------------------------------------------------- |
63+
| `u:dir` | The [u:dir](../spec/u-namespace.md#udir) option |
64+
| `u:id` | The [u:id](../spec/u-namespace.md#uid) option |
65+
| `u:locale` | The [u:locale](../spec/u-namespace.md#ulocale) option |
66+
5367
## Test Functions
5468

5569
As the behaviour of some of the default registry _functions_
@@ -68,6 +82,7 @@ The function `:test:function` requires a [Number Operand](/spec/registry.md#numb
6882
#### Options
6983

7084
The following _options_ are available on `:test:function`:
85+
7186
- `decimalPlaces`, a _digit size option_ for which only `0` and `1` are valid values.
7287
- `0`
7388
- `1`

test/schemas/v0/tests.schema.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@
128128
"params": {
129129
"$ref": "#/$defs/params"
130130
},
131+
"tags": {
132+
"$ref": "#/$defs/tags"
133+
},
131134
"exp": {
132135
"$ref": "#/$defs/exp"
133136
},
@@ -159,6 +162,9 @@
159162
"params": {
160163
"$ref": "#/$defs/params"
161164
},
165+
"tags": {
166+
"$ref": "#/$defs/tags"
167+
},
162168
"exp": {
163169
"$ref": "#/$defs/exp"
164170
},
@@ -193,6 +199,17 @@
193199
"$ref": "#/$defs/var"
194200
}
195201
},
202+
"tags": {
203+
"description": "List of features that the test relies on.",
204+
"type": "array",
205+
"items": {
206+
"enum": [
207+
"u:dir",
208+
"u:id",
209+
"u:locale"
210+
]
211+
}
212+
},
196213
"var": {
197214
"type": "object",
198215
"oneOf": [

test/tests/u-options.json

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,44 @@
88
},
99
"tests": [
1010
{
11+
"tags": ["u:id"],
1112
"src": "{#tag u:id=x}content{/ns:tag u:id=x}",
1213
"exp": "content",
1314
"expParts": [
14-
{
15-
"type": "markup",
16-
"kind": "open",
17-
"id": "x",
18-
"name": "tag"
19-
},
15+
{ "type": "markup", "kind": "open", "id": "x", "name": "tag" },
2016
{ "type": "text", "value": "content" },
21-
{
22-
"type": "markup",
23-
"kind": "close",
24-
"id": "x",
25-
"name": "ns:tag"
26-
}
17+
{ "type": "markup", "kind": "close", "id": "x", "name": "ns:tag" }
2718
]
2819
},
2920
{
30-
"src": "{#tag u:dir=rtl u:locale=ar}content{/ns:tag}",
21+
"tags": ["u:dir"],
22+
"src": "{#tag u:dir=rtl}content{/ns:tag}",
3123
"exp": "content",
32-
"expErrors": [{ "type": "bad-option" }, { "type": "bad-option" }],
24+
"expErrors": [{ "type": "bad-option" }],
3325
"expParts": [
34-
{
35-
"type": "markup",
36-
"kind": "open",
37-
"name": "tag"
38-
},
26+
{ "type": "markup", "kind": "open", "name": "tag" },
3927
{ "type": "text", "value": "content" },
40-
{
41-
"type": "markup",
42-
"kind": "close",
43-
"name": "ns:tag"
44-
}
28+
{ "type": "markup", "kind": "close", "name": "ns:tag" }
4529
]
4630
},
4731
{
32+
"tags": ["u:locale"],
4833
"src": "hello {4.2 :number u:locale=fr}",
4934
"exp": "hello 4,2"
5035
},
5136
{
37+
"tags": ["u:dir", "u:locale"],
38+
"src": "{#tag u:dir=rtl u:locale=ar}content{/ns:tag}",
39+
"exp": "content",
40+
"expErrors": [{ "type": "bad-option" }],
41+
"expParts": [
42+
{ "type": "markup", "kind": "open", "name": "tag" },
43+
{ "type": "text", "value": "content" },
44+
{ "type": "markup", "kind": "close", "name": "ns:tag" }
45+
]
46+
},
47+
{
48+
"tags": ["u:dir", "u:id"],
5249
"src": "hello {world :string u:dir=ltr u:id=foo}",
5350
"exp": "hello \u2066world\u2069",
5451
"expParts": [
@@ -60,6 +57,7 @@
6057
]
6158
},
6259
{
60+
"tags": ["u:dir"],
6361
"src": "hello {world :string u:dir=rtl}",
6462
"exp": "hello \u2067world\u2069",
6563
"expParts": [
@@ -70,6 +68,7 @@
7068
]
7169
},
7270
{
71+
"tags": ["u:dir"],
7372
"src": "hello {world :string u:dir=auto}",
7473
"exp": "hello \u2068world\u2069",
7574
"expParts": [
@@ -84,6 +83,7 @@
8483
]
8584
},
8685
{
86+
"tags": ["u:dir", "u:id"],
8787
"src": ".local $world = {world :string u:dir=ltr u:id=foo} {{hello {$world}}}",
8888
"exp": "hello \u2066world\u2069",
8989
"expParts": [
@@ -94,16 +94,19 @@
9494
]
9595
},
9696
{
97+
"tags": ["u:dir"],
9798
"locale": "ar",
9899
"src": "أهلاً {بالعالم :string u:dir=rtl}",
99100
"exp": "أهلاً \u2067بالعالم\u2069"
100101
},
101102
{
103+
"tags": ["u:dir"],
102104
"locale": "ar",
103105
"src": "أهلاً {بالعالم :string u:dir=auto}",
104106
"exp": "أهلاً \u2068بالعالم\u2069"
105107
},
106108
{
109+
"tags": ["u:dir"],
107110
"locale": "ar",
108111
"src": "أهلاً {world :string u:dir=ltr}",
109112
"exp": "أهلاً \u2066world\u2069"

0 commit comments

Comments
 (0)