Skip to content

Add test tags, initially for u: options #1050

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

Merged
merged 2 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ is not included in the schema,
as it is intended to be an umbrella category
for implementation-specific errors.

## Test Tags

Some of the tests are for functionality that is not stable,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. Items that are not MUST are stable, just not required.

i.e. is marked RECOMMENDED, OPTIONAL, or DRAFT.
Tests for such features have a `tags` array attached to them
to mark the features that they rely on.
This may include one or more of the following:

| Tag | Feature |
| ---------- | ----------------------------------------------------- |
| `u:dir` | The [u:dir](../spec/u-namespace.md#udir) option |
| `u:id` | The [u:id](../spec/u-namespace.md#uid) option |
| `u:locale` | The [u:locale](../spec/u-namespace.md#ulocale) option |

## Test Functions

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

The following _options_ are available on `:test:function`:

- `decimalPlaces`, a _digit size option_ for which only `0` and `1` are valid values.
- `0`
- `1`
Expand Down
17 changes: 17 additions & 0 deletions test/schemas/v0/tests.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@
"params": {
"$ref": "#/$defs/params"
},
"tags": {
"$ref": "#/$defs/tags"
},
"exp": {
"$ref": "#/$defs/exp"
},
Expand Down Expand Up @@ -155,6 +158,9 @@
"params": {
"$ref": "#/$defs/params"
},
"tags": {
"$ref": "#/$defs/tags"
},
"exp": {
"$ref": "#/$defs/exp"
},
Expand Down Expand Up @@ -189,6 +195,17 @@
"$ref": "#/$defs/var"
}
},
"tags": {
"description": "List of features that the test relies on.",
"type": "array",
"items": {
"enum": [
"u:dir",
"u:id",
"u:locale"
]
}
},
"var": {
"type": "object",
"oneOf": [
Expand Down
51 changes: 27 additions & 24 deletions test/tests/u-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,44 @@
},
"tests": [
{
"tags": ["u:id"],
"src": "{#tag u:id=x}content{/ns:tag u:id=x}",
"exp": "content",
"expParts": [
{
"type": "markup",
"kind": "open",
"id": "x",
"name": "tag"
},
{ "type": "markup", "kind": "open", "id": "x", "name": "tag" },
{ "type": "text", "value": "content" },
{
"type": "markup",
"kind": "close",
"id": "x",
"name": "ns:tag"
}
{ "type": "markup", "kind": "close", "id": "x", "name": "ns:tag" }
]
},
{
"src": "{#tag u:dir=rtl u:locale=ar}content{/ns:tag}",
"tags": ["u:dir"],
"src": "{#tag u:dir=rtl}content{/ns:tag}",
"exp": "content",
"expErrors": [{ "type": "bad-option" }, { "type": "bad-option" }],
"expErrors": [{ "type": "bad-option" }],
"expParts": [
{
"type": "markup",
"kind": "open",
"name": "tag"
},
{ "type": "markup", "kind": "open", "name": "tag" },
{ "type": "text", "value": "content" },
{
"type": "markup",
"kind": "close",
"name": "ns:tag"
}
{ "type": "markup", "kind": "close", "name": "ns:tag" }
]
},
{
"tags": ["u:locale"],
"src": "hello {4.2 :number u:locale=fr}",
"exp": "hello 4,2"
},
{
"tags": ["u:dir", "u:locale"],
"src": "{#tag u:dir=rtl u:locale=ar}content{/ns:tag}",
"exp": "content",
"expErrors": [{ "type": "bad-option" }],
"expParts": [
{ "type": "markup", "kind": "open", "name": "tag" },
{ "type": "text", "value": "content" },
{ "type": "markup", "kind": "close", "name": "ns:tag" }
]
},
{
"tags": ["u:dir", "u:id"],
"src": "hello {world :string u:dir=ltr u:id=foo}",
"exp": "hello \u2066world\u2069",
"expParts": [
Expand All @@ -66,6 +63,7 @@
]
},
{
"tags": ["u:dir"],
"src": "hello {world :string u:dir=rtl}",
"exp": "hello \u2067world\u2069",
"expParts": [
Expand All @@ -82,6 +80,7 @@
]
},
{
"tags": ["u:dir"],
"src": "hello {world :string u:dir=auto}",
"exp": "hello \u2068world\u2069",
"expParts": [
Expand All @@ -97,6 +96,7 @@
]
},
{
"tags": ["u:dir", "u:id"],
"src": ".local $world = {world :string u:dir=ltr u:id=foo} {{hello {$world}}}",
"exp": "hello \u2066world\u2069",
"expParts": [
Expand All @@ -113,16 +113,19 @@
]
},
{
"tags": ["u:dir"],
"locale": "ar",
"src": "أهلاً {بالعالم :string u:dir=rtl}",
"exp": "أهلاً \u2067بالعالم\u2069"
},
{
"tags": ["u:dir"],
"locale": "ar",
"src": "أهلاً {بالعالم :string u:dir=auto}",
"exp": "أهلاً \u2068بالعالم\u2069"
},
{
"tags": ["u:dir"],
"locale": "ar",
"src": "أهلاً {world :string u:dir=ltr}",
"exp": "أهلاً \u2066world\u2069"
Expand Down