From 93223c28434ba1c49e35c529cf9e6450ca0d797f Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Wed, 26 Mar 2025 02:04:20 +0200 Subject: [PATCH 1/2] Add test tags, initially for u: options --- test/schemas/v0/tests.schema.json | 17 +++++++++++ test/tests/u-options.json | 51 ++++++++++++++++--------------- 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/test/schemas/v0/tests.schema.json b/test/schemas/v0/tests.schema.json index 96aaf2a975..6e3868c88c 100644 --- a/test/schemas/v0/tests.schema.json +++ b/test/schemas/v0/tests.schema.json @@ -124,6 +124,9 @@ "params": { "$ref": "#/$defs/params" }, + "tags": { + "$ref": "#/$defs/tags" + }, "exp": { "$ref": "#/$defs/exp" }, @@ -155,6 +158,9 @@ "params": { "$ref": "#/$defs/params" }, + "tags": { + "$ref": "#/$defs/tags" + }, "exp": { "$ref": "#/$defs/exp" }, @@ -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": [ diff --git a/test/tests/u-options.json b/test/tests/u-options.json index 6ae9264f71..4606bb03ab 100644 --- a/test/tests/u-options.json +++ b/test/tests/u-options.json @@ -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": [ @@ -66,6 +63,7 @@ ] }, { + "tags": ["u:dir"], "src": "hello {world :string u:dir=rtl}", "exp": "hello \u2067world\u2069", "expParts": [ @@ -82,6 +80,7 @@ ] }, { + "tags": ["u:dir"], "src": "hello {world :string u:dir=auto}", "exp": "hello \u2068world\u2069", "expParts": [ @@ -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": [ @@ -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" From 41de84d11152ca5193d8a9646349e7dfe69be542 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Wed, 26 Mar 2025 02:25:58 +0200 Subject: [PATCH 2/2] Add documentation for test tags --- test/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/README.md b/test/README.md index 86d19b6fe4..7fd2fb698d 100644 --- a/test/README.md +++ b/test/README.md @@ -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, +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_ @@ -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`