From b2e9979ba394600ec09cacf0490b439d7668e915 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:16 +0200 Subject: [PATCH 01/24] test: cover position-specific strict errors in decode/validation-errors.json --- tests/fixtures/decode/validation-errors.json | 73 ++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/tests/fixtures/decode/validation-errors.json b/tests/fixtures/decode/validation-errors.json index e3ad253..afdb330 100644 --- a/tests/fixtures/decode/validation-errors.json +++ b/tests/fixtures/decode/validation-errors.json @@ -503,6 +503,79 @@ "specSection": "5.2", "note": "A scalar line outside root primitive position is an error in strict and non-strict mode alike", "minSpecVersion": "4.1" + }, + { + "name": "throws on the removed [#N] length marker in a root header in strict mode", + "input": "[#2]: a,b", + "expected": null, + "shouldError": true, + "options": { + "strict": true + }, + "specSection": "6" + }, + { + "name": "throws on the removed [#N] length marker in a field header in strict mode", + "input": "xs[#2]: a,b", + "expected": null, + "shouldError": true, + "options": { + "strict": true + }, + "specSection": "6" + }, + { + "name": "throws on the removed [#N] length marker in a nested field header in strict mode", + "input": "o:\n xs[#2]: a,b", + "expected": null, + "shouldError": true, + "options": { + "strict": true + }, + "specSection": "6" + }, + { + "name": "throws on the removed [#N] length marker in a keyless list-item header in strict mode", + "input": "items[1]:\n - [#2]: a,b", + "expected": null, + "shouldError": true, + "options": { + "strict": true + }, + "specSection": "6" + }, + { + "name": "throws on the removed [#N] length marker in a list-item first-field header in strict mode", + "input": "items[1]:\n - xs[#2]: a,b", + "expected": null, + "shouldError": true, + "options": { + "strict": true + }, + "specSection": "6" + }, + { + "name": "throws on tabular row count mismatch inside a later list item", + "input": "groups[2]:\n - a: foo\n b[1]{w,x}:\n wince,0\n - a: bar\n b[0]{w,x}:\n wise,1", + "expected": null, + "shouldError": true, + "specSection": "14.1" + }, + { + "name": "throws on a tab after a quoted value's closing quote", + "input": "k: \"a\"\t", + "expected": null, + "shouldError": true, + "specSection": "7.4", + "minSpecVersion": "4.1" + }, + { + "name": "throws on a tab after a quoted key's closing quote", + "input": "\"a\"\t: 1", + "expected": null, + "shouldError": true, + "specSection": "7.4", + "minSpecVersion": "4.1" } ] } From 70cd82a4680cc683ed358dae47a9ad5e1601441a Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:16 +0200 Subject: [PATCH 02/24] test: cover tabs and lone carriage returns as content in decode/whitespace.json --- tests/fixtures/decode/whitespace.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/fixtures/decode/whitespace.json b/tests/fixtures/decode/whitespace.json index fc22ed3..3667076 100644 --- a/tests/fixtures/decode/whitespace.json +++ b/tests/fixtures/decode/whitespace.json @@ -124,6 +124,33 @@ "specSection": "12", "note": "Trailing spaces are stripped before line classification", "minSpecVersion": "4.1" + }, + { + "name": "keeps a trailing tab in an unquoted value", + "input": "k: v\t", + "expected": { + "k": "v\t" + }, + "specSection": "12" + }, + { + "name": "keeps a tab after a comma delimiter as part of the token", + "input": "items[2]: a,\tb", + "expected": { + "items": [ + "a", + "\tb" + ] + }, + "specSection": "12" + }, + { + "name": "keeps a carriage return inside a line as content", + "input": "a: x\ry", + "expected": { + "a": "x\ry" + }, + "specSection": "12" } ] } From 986f49bb3ae4829288e26ee1e7541ae0b332ed2e Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:17 +0200 Subject: [PATCH 03/24] test: cover a leading blank line before a root primitive in decode/root-form.json --- tests/fixtures/decode/root-form.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/fixtures/decode/root-form.json b/tests/fixtures/decode/root-form.json index 32bc71f..6378932 100644 --- a/tests/fixtures/decode/root-form.json +++ b/tests/fixtures/decode/root-form.json @@ -78,6 +78,15 @@ "strict": true }, "specSection": "5" + }, + { + "name": "parses a root primitive after a leading blank line", + "input": "\nhello", + "expected": "hello", + "options": { + "strict": true + }, + "specSection": "5" } ] } From b3fd41bb5c6d4afd2685291ae02080cd399f8a26 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:17 +0200 Subject: [PATCH 04/24] test: cover header-shaped and empty quoted keys in decode/objects.json --- tests/fixtures/decode/objects.json | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/fixtures/decode/objects.json b/tests/fixtures/decode/objects.json index 1e42dbf..f8070fb 100644 --- a/tests/fixtures/decode/objects.json +++ b/tests/fixtures/decode/objects.json @@ -509,6 +509,43 @@ }, "specSection": "7.4", "minSpecVersion": "4.1" + }, + { + "name": "parses quoted dotted key as a single literal key", + "input": "\"a.b\": 1", + "expected": { + "a.b": 1 + }, + "specSection": "8" + }, + { + "name": "parses quoted empty string key opening a nested object", + "input": "\"\":\n a: 1", + "expected": { + "": { + "a": 1 + } + }, + "specSection": "8" + }, + { + "name": "parses quoted key containing a bracket segment and colon", + "input": "\"k [2]: y\": 1", + "expected": { + "k [2]: y": 1 + }, + "specSection": "5.2" + }, + { + "name": "materializes __proto__ as an array header key", + "input": "__proto__[2]: 1,2", + "expected": { + "__proto__": [ + 1, + 2 + ] + }, + "specSection": "15" } ] } From 97ab0a4faa92b4e51f9ff2189925efb2279f0636 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:17 +0200 Subject: [PATCH 05/24] test: cover deep nesting and list-item object fields in decode/arrays-nested.json --- tests/fixtures/decode/arrays-nested.json | 60 ++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/fixtures/decode/arrays-nested.json b/tests/fixtures/decode/arrays-nested.json index 57ffe90..5586d6c 100644 --- a/tests/fixtures/decode/arrays-nested.json +++ b/tests/fixtures/decode/arrays-nested.json @@ -244,6 +244,66 @@ "shouldError": true, "specSection": "9.4", "minSpecVersion": "4.1" + }, + { + "name": "parses three levels of nested arrays", + "input": "[1]:\n - [1]:\n - [1]: 1", + "expected": [ + [ + [ + 1 + ] + ] + ], + "specSection": "9.4" + }, + { + "name": "parses an empty object as the first field of a list-item object", + "input": "items[1]:\n - a:", + "expected": { + "items": [ + { + "a": {} + } + ] + }, + "specSection": "10" + }, + { + "name": "parses a tabular array as a later field of a list-item object", + "input": "items[1]:\n - id: 1\n users[2]{id,name}:\n 1,Ada\n 2,Bob", + "expected": { + "items": [ + { + "id": 1, + "users": [ + { + "id": 1, + "name": "Ada" + }, + { + "id": 2, + "name": "Bob" + } + ] + } + ] + }, + "specSection": "10" + }, + { + "name": "parses quoted structural strings as list items", + "input": "xs[3]:\n - \"[2]: x\"\n - \"a: b\"\n - k: 1", + "expected": { + "xs": [ + "[2]: x", + "a: b", + { + "k": 1 + } + ] + }, + "specSection": "9.4" } ] } From 8d5b15c874a519e68f7ca35fabdd38919e7380f3 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:17 +0200 Subject: [PATCH 06/24] test: cover structural strings in cells in decode/arrays-tabular.json --- tests/fixtures/decode/arrays-tabular.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/fixtures/decode/arrays-tabular.json b/tests/fixtures/decode/arrays-tabular.json index 9c18ed9..a8a4e69 100644 --- a/tests/fixtures/decode/arrays-tabular.json +++ b/tests/fixtures/decode/arrays-tabular.json @@ -217,6 +217,23 @@ "specSection": "14.1", "note": "A declared [N] never truncates a scope", "minSpecVersion": "4.1" + }, + { + "name": "parses quoted structural strings in tabular cells", + "input": "rows[2]{id,note}:\n 1,\"[2]: x\"\n 2,\"a: b, c\"", + "expected": { + "rows": [ + { + "id": 1, + "note": "[2]: x" + }, + { + "id": 2, + "note": "a: b, c" + } + ] + }, + "specSection": "9.3" } ] } From d09aa2d5b7a461fbcb6f41c545f9c56e8297295a Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:17 +0200 Subject: [PATCH 07/24] test: cover a quoted key with escaped quotes as an array key in decode/arrays-primitive.json --- tests/fixtures/decode/arrays-primitive.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/fixtures/decode/arrays-primitive.json b/tests/fixtures/decode/arrays-primitive.json index e09b87f..8797162 100644 --- a/tests/fixtures/decode/arrays-primitive.json +++ b/tests/fixtures/decode/arrays-primitive.json @@ -154,6 +154,18 @@ "": [] }, "specSection": "9.1" + }, + { + "name": "parses quoted key with escaped quotes and brackets as an inline array key", + "input": "\"has \\\"[2]\\\" in it\"[3]: 3,4,5", + "expected": { + "has \"[2]\" in it": [ + 3, + 4, + 5 + ] + }, + "specSection": "9.1" } ] } From b20abb59d5b374f5b21bc14b1bcdc4c2dc0a1ed6 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:17 +0200 Subject: [PATCH 08/24] test: cover header-shaped and empty keys in encode/objects.json --- tests/fixtures/encode/objects.json | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/fixtures/encode/objects.json b/tests/fixtures/encode/objects.json index a63f92c..eece64e 100644 --- a/tests/fixtures/encode/objects.json +++ b/tests/fixtures/encode/objects.json @@ -292,6 +292,35 @@ }, "expected": "note: \"#x\"", "specSection": "7.2" + }, + { + "name": "encodes empty string key opening a nested object", + "input": { + "": { + "a": 1 + } + }, + "expected": "\"\":\n a: 1", + "specSection": "8" + }, + { + "name": "quotes key containing a bracket segment and colon", + "input": { + "k [2]: y": 1 + }, + "expected": "\"k [2]: y\": 1", + "specSection": "7.3" + }, + { + "name": "encodes __proto__ as an array header key", + "input": { + "__proto__": [ + 1, + 2 + ] + }, + "expected": "__proto__[2]: 1,2", + "specSection": "15" } ] } From 756ad4ffdb218e445588fdc60683c2165b82f2fd Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:17 +0200 Subject: [PATCH 09/24] test: cover deep nesting and structural list items in encode/arrays-nested.json --- tests/fixtures/encode/arrays-nested.json | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/fixtures/encode/arrays-nested.json b/tests/fixtures/encode/arrays-nested.json index 69c570e..a3236ac 100644 --- a/tests/fixtures/encode/arrays-nested.json +++ b/tests/fixtures/encode/arrays-nested.json @@ -127,6 +127,32 @@ "specSection": "9.3", "note": "A keyless fields-bearing header is valid only at the document root", "minSpecVersion": "4.1" + }, + { + "name": "encodes three levels of nested arrays", + "input": [ + [ + [ + 1 + ] + ] + ], + "expected": "[1]:\n - [1]:\n - [1]: 1", + "specSection": "9.4" + }, + { + "name": "quotes structural strings as list items", + "input": { + "xs": [ + "[2]: x", + "a: b", + { + "k": 1 + } + ] + }, + "expected": "xs[3]:\n - \"[2]: x\"\n - \"a: b\"\n - k: 1", + "specSection": "7.2" } ] } From d78f43e3ef9206c71ce4d253a80802b529c3d39d Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:17 +0200 Subject: [PATCH 10/24] test: cover an empty object as the first list-item field in encode/arrays-objects.json --- tests/fixtures/encode/arrays-objects.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/fixtures/encode/arrays-objects.json b/tests/fixtures/encode/arrays-objects.json index ad8342b..0660824 100644 --- a/tests/fixtures/encode/arrays-objects.json +++ b/tests/fixtures/encode/arrays-objects.json @@ -186,6 +186,18 @@ "specSection": "9.5", "note": "Keyed tabular form is mandated in object-field and root positions, not in a column", "minSpecVersion": "4.1" + }, + { + "name": "places an empty object first field on the hyphen line", + "input": { + "items": [ + { + "a": {} + } + ] + }, + "expected": "items[1]:\n - a:", + "specSection": "10" } ] } From cfbd2dd68caad3e0100b34b8a7cfdc0266f2a244 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:17 +0200 Subject: [PATCH 11/24] test: cover structural strings in cells in encode/arrays-tabular.json --- tests/fixtures/encode/arrays-tabular.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/fixtures/encode/arrays-tabular.json b/tests/fixtures/encode/arrays-tabular.json index 2365042..32602e3 100644 --- a/tests/fixtures/encode/arrays-tabular.json +++ b/tests/fixtures/encode/arrays-tabular.json @@ -177,6 +177,23 @@ "expected": "items[1]:\n - id: 1\n meta:", "specSection": "9.3", "note": "Nested-uniform requires non-empty objects, mirroring the empty-object exclusion for elements" + }, + { + "name": "quotes structural strings in tabular cells", + "input": { + "rows": [ + { + "id": 1, + "note": "[2]: x" + }, + { + "id": 2, + "note": "a: b, c" + } + ] + }, + "expected": "rows[2]{id,note}:\n 1,\"[2]: x\"\n 2,\"a: b, c\"", + "specSection": "9.3" } ] } From bf6094ecf3c5c5dd2684e0c75ee3f3349d6c518f Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 2 Oct 2026 18:17:17 +0200 Subject: [PATCH 12/24] test: cover a quoted key with escaped quotes as an array key in encode/arrays-primitive.json --- tests/fixtures/encode/arrays-primitive.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/fixtures/encode/arrays-primitive.json b/tests/fixtures/encode/arrays-primitive.json index 5644091..9c5759c 100644 --- a/tests/fixtures/encode/arrays-primitive.json +++ b/tests/fixtures/encode/arrays-primitive.json @@ -106,6 +106,18 @@ }, "expected": "tags[2]: \"#a\",b", "specSection": "7.2" + }, + { + "name": "quotes key with escaped quotes and brackets as an inline array key", + "input": { + "has \"[2]\" in it": [ + 3, + 4, + 5 + ] + }, + "expected": "\"has \\\"[2]\\\" in it\"[3]: 3,4,5", + "specSection": "7.3" } ] } From 92faf2f1a343e0922a30b97053cea8943f834f5c Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Sat, 3 Oct 2026 20:56:51 +0200 Subject: [PATCH 13/24] test: drop the new cases that repeat existing coverage --- tests/fixtures/decode/objects.json | 8 -------- tests/fixtures/decode/validation-errors.json | 10 ---------- tests/fixtures/encode/arrays-nested.json | 14 -------------- tests/fixtures/encode/arrays-primitive.json | 12 ------------ tests/fixtures/encode/arrays-tabular.json | 17 ----------------- tests/fixtures/encode/objects.json | 19 ------------------- 6 files changed, 80 deletions(-) diff --git a/tests/fixtures/decode/objects.json b/tests/fixtures/decode/objects.json index f8070fb..467f435 100644 --- a/tests/fixtures/decode/objects.json +++ b/tests/fixtures/decode/objects.json @@ -510,14 +510,6 @@ "specSection": "7.4", "minSpecVersion": "4.1" }, - { - "name": "parses quoted dotted key as a single literal key", - "input": "\"a.b\": 1", - "expected": { - "a.b": 1 - }, - "specSection": "8" - }, { "name": "parses quoted empty string key opening a nested object", "input": "\"\":\n a: 1", diff --git a/tests/fixtures/decode/validation-errors.json b/tests/fixtures/decode/validation-errors.json index afdb330..d4cf21a 100644 --- a/tests/fixtures/decode/validation-errors.json +++ b/tests/fixtures/decode/validation-errors.json @@ -524,16 +524,6 @@ }, "specSection": "6" }, - { - "name": "throws on the removed [#N] length marker in a nested field header in strict mode", - "input": "o:\n xs[#2]: a,b", - "expected": null, - "shouldError": true, - "options": { - "strict": true - }, - "specSection": "6" - }, { "name": "throws on the removed [#N] length marker in a keyless list-item header in strict mode", "input": "items[1]:\n - [#2]: a,b", diff --git a/tests/fixtures/encode/arrays-nested.json b/tests/fixtures/encode/arrays-nested.json index a3236ac..9f12d13 100644 --- a/tests/fixtures/encode/arrays-nested.json +++ b/tests/fixtures/encode/arrays-nested.json @@ -139,20 +139,6 @@ ], "expected": "[1]:\n - [1]:\n - [1]: 1", "specSection": "9.4" - }, - { - "name": "quotes structural strings as list items", - "input": { - "xs": [ - "[2]: x", - "a: b", - { - "k": 1 - } - ] - }, - "expected": "xs[3]:\n - \"[2]: x\"\n - \"a: b\"\n - k: 1", - "specSection": "7.2" } ] } diff --git a/tests/fixtures/encode/arrays-primitive.json b/tests/fixtures/encode/arrays-primitive.json index 9c5759c..5644091 100644 --- a/tests/fixtures/encode/arrays-primitive.json +++ b/tests/fixtures/encode/arrays-primitive.json @@ -106,18 +106,6 @@ }, "expected": "tags[2]: \"#a\",b", "specSection": "7.2" - }, - { - "name": "quotes key with escaped quotes and brackets as an inline array key", - "input": { - "has \"[2]\" in it": [ - 3, - 4, - 5 - ] - }, - "expected": "\"has \\\"[2]\\\" in it\"[3]: 3,4,5", - "specSection": "7.3" } ] } diff --git a/tests/fixtures/encode/arrays-tabular.json b/tests/fixtures/encode/arrays-tabular.json index 32602e3..2365042 100644 --- a/tests/fixtures/encode/arrays-tabular.json +++ b/tests/fixtures/encode/arrays-tabular.json @@ -177,23 +177,6 @@ "expected": "items[1]:\n - id: 1\n meta:", "specSection": "9.3", "note": "Nested-uniform requires non-empty objects, mirroring the empty-object exclusion for elements" - }, - { - "name": "quotes structural strings in tabular cells", - "input": { - "rows": [ - { - "id": 1, - "note": "[2]: x" - }, - { - "id": 2, - "note": "a: b, c" - } - ] - }, - "expected": "rows[2]{id,note}:\n 1,\"[2]: x\"\n 2,\"a: b, c\"", - "specSection": "9.3" } ] } diff --git a/tests/fixtures/encode/objects.json b/tests/fixtures/encode/objects.json index eece64e..7441aa4 100644 --- a/tests/fixtures/encode/objects.json +++ b/tests/fixtures/encode/objects.json @@ -302,25 +302,6 @@ }, "expected": "\"\":\n a: 1", "specSection": "8" - }, - { - "name": "quotes key containing a bracket segment and colon", - "input": { - "k [2]: y": 1 - }, - "expected": "\"k [2]: y\": 1", - "specSection": "7.3" - }, - { - "name": "encodes __proto__ as an array header key", - "input": { - "__proto__": [ - 1, - 2 - ] - }, - "expected": "__proto__[2]: 1,2", - "specSection": "15" } ] } From 1d0f478787a388ba414af2d35cd7cf33f973ac6c Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Sat, 3 Oct 2026 21:05:59 +0200 Subject: [PATCH 14/24] test: let only the row count reject the count mismatch in a later list item --- tests/fixtures/decode/validation-errors.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/decode/validation-errors.json b/tests/fixtures/decode/validation-errors.json index d4cf21a..93b1102 100644 --- a/tests/fixtures/decode/validation-errors.json +++ b/tests/fixtures/decode/validation-errors.json @@ -546,7 +546,7 @@ }, { "name": "throws on tabular row count mismatch inside a later list item", - "input": "groups[2]:\n - a: foo\n b[1]{w,x}:\n wince,0\n - a: bar\n b[0]{w,x}:\n wise,1", + "input": "groups[2]:\n - a: foo\n b[1]{w,x}:\n wince,0\n - a: bar\n b[2]{w,x}:\n wise,1", "expected": null, "shouldError": true, "specSection": "14.1" From 0c92220e00b32432cb9001623c4d486c73a4d7ce Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Sat, 3 Oct 2026 21:05:59 +0200 Subject: [PATCH 15/24] test: lead the tabular rows with the quoted structural cell --- tests/fixtures/decode/arrays-tabular.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/fixtures/decode/arrays-tabular.json b/tests/fixtures/decode/arrays-tabular.json index a8a4e69..b951cd4 100644 --- a/tests/fixtures/decode/arrays-tabular.json +++ b/tests/fixtures/decode/arrays-tabular.json @@ -220,16 +220,16 @@ }, { "name": "parses quoted structural strings in tabular cells", - "input": "rows[2]{id,note}:\n 1,\"[2]: x\"\n 2,\"a: b, c\"", + "input": "rows[2]{note,id}:\n \"[2]: x\",1\n \"a: b, c\",2", "expected": { "rows": [ { - "id": 1, - "note": "[2]: x" + "note": "[2]: x", + "id": 1 }, { - "id": 2, - "note": "a: b, c" + "note": "a: b, c", + "id": 2 } ] }, From d567206ea995ff54d9c50378bbe12c97407d9ed4 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Sat, 3 Oct 2026 21:05:59 +0200 Subject: [PATCH 16/24] test: name the `__proto__` array header case after its result --- tests/fixtures/decode/objects.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/decode/objects.json b/tests/fixtures/decode/objects.json index 467f435..e0e72c2 100644 --- a/tests/fixtures/decode/objects.json +++ b/tests/fixtures/decode/objects.json @@ -529,7 +529,7 @@ "specSection": "5.2" }, { - "name": "materializes __proto__ as an array header key", + "name": "materializes __proto__ array header key as an ordinary own key", "input": "__proto__[2]: 1,2", "expected": { "__proto__": [ From 23537054ba2b19f73480b31a828fbfa3f9ab33a9 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Mon, 5 Oct 2026 08:32:22 +0200 Subject: [PATCH 17/24] test: catch the row count mismatch in a later field of a single list item --- tests/fixtures/decode/validation-errors.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fixtures/decode/validation-errors.json b/tests/fixtures/decode/validation-errors.json index 93b1102..5e20b3e 100644 --- a/tests/fixtures/decode/validation-errors.json +++ b/tests/fixtures/decode/validation-errors.json @@ -545,8 +545,8 @@ "specSection": "6" }, { - "name": "throws on tabular row count mismatch inside a later list item", - "input": "groups[2]:\n - a: foo\n b[1]{w,x}:\n wince,0\n - a: bar\n b[2]{w,x}:\n wise,1", + "name": "throws on tabular row count mismatch in a later field of a list-item object", + "input": "items[1]:\n - id: 1\n users[2]{id,name}:\n 1,Ada", "expected": null, "shouldError": true, "specSection": "14.1" From cd66f51bd20478ad3f21724d03c2e0c6a33dc536 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Mon, 5 Oct 2026 08:32:22 +0200 Subject: [PATCH 18/24] test: reduce the quoted list item case to the header-shaped string --- tests/fixtures/decode/arrays-nested.json | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/fixtures/decode/arrays-nested.json b/tests/fixtures/decode/arrays-nested.json index 5586d6c..f552728 100644 --- a/tests/fixtures/decode/arrays-nested.json +++ b/tests/fixtures/decode/arrays-nested.json @@ -292,15 +292,11 @@ "specSection": "10" }, { - "name": "parses quoted structural strings as list items", - "input": "xs[3]:\n - \"[2]: x\"\n - \"a: b\"\n - k: 1", + "name": "parses quoted list item shaped like an inline array header", + "input": "xs[1]:\n - \"[2]: x\"", "expected": { "xs": [ - "[2]: x", - "a: b", - { - "k": 1 - } + "[2]: x" ] }, "specSection": "9.4" From 0de30b6e5d0ebfa0cdda537de3ce2642b351ae35 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Mon, 5 Oct 2026 08:32:22 +0200 Subject: [PATCH 19/24] test: follow the empty first field with a sibling field --- tests/fixtures/decode/arrays-nested.json | 5 +++-- tests/fixtures/encode/arrays-objects.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/fixtures/decode/arrays-nested.json b/tests/fixtures/decode/arrays-nested.json index f552728..d489562 100644 --- a/tests/fixtures/decode/arrays-nested.json +++ b/tests/fixtures/decode/arrays-nested.json @@ -259,11 +259,12 @@ }, { "name": "parses an empty object as the first field of a list-item object", - "input": "items[1]:\n - a:", + "input": "items[1]:\n - a:\n b: 1", "expected": { "items": [ { - "a": {} + "a": {}, + "b": 1 } ] }, diff --git a/tests/fixtures/encode/arrays-objects.json b/tests/fixtures/encode/arrays-objects.json index 0660824..c462ded 100644 --- a/tests/fixtures/encode/arrays-objects.json +++ b/tests/fixtures/encode/arrays-objects.json @@ -192,11 +192,12 @@ "input": { "items": [ { - "a": {} + "a": {}, + "b": 1 } ] }, - "expected": "items[1]:\n - a:", + "expected": "items[1]:\n - a:\n b: 1", "specSection": "10" } ] From c9799bc9692299f2f2f9056fcdb1c3de9e9b8866 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Mon, 5 Oct 2026 08:32:23 +0200 Subject: [PATCH 20/24] test: name the array-of-arrays cases after their list-item position --- tests/fixtures/decode/arrays-nested.json | 2 +- tests/fixtures/encode/arrays-nested.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fixtures/decode/arrays-nested.json b/tests/fixtures/decode/arrays-nested.json index d489562..69e3a40 100644 --- a/tests/fixtures/decode/arrays-nested.json +++ b/tests/fixtures/decode/arrays-nested.json @@ -246,7 +246,7 @@ "minSpecVersion": "4.1" }, { - "name": "parses three levels of nested arrays", + "name": "parses an array of arrays in list-item position", "input": "[1]:\n - [1]:\n - [1]: 1", "expected": [ [ diff --git a/tests/fixtures/encode/arrays-nested.json b/tests/fixtures/encode/arrays-nested.json index 9f12d13..bc2abc4 100644 --- a/tests/fixtures/encode/arrays-nested.json +++ b/tests/fixtures/encode/arrays-nested.json @@ -129,7 +129,7 @@ "minSpecVersion": "4.1" }, { - "name": "encodes three levels of nested arrays", + "name": "uses list form for an array of arrays in list-item position", "input": [ [ [ From 9ed2cf4db681d828522828f345bb6a324a2119d2 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Mon, 5 Oct 2026 08:32:23 +0200 Subject: [PATCH 21/24] test: name the escaped-quote header key case like its siblings --- tests/fixtures/decode/arrays-primitive.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/decode/arrays-primitive.json b/tests/fixtures/decode/arrays-primitive.json index 8797162..89aef8e 100644 --- a/tests/fixtures/decode/arrays-primitive.json +++ b/tests/fixtures/decode/arrays-primitive.json @@ -156,7 +156,7 @@ "specSection": "9.1" }, { - "name": "parses quoted key with escaped quotes and brackets as an inline array key", + "name": "parses quoted key containing escaped quotes and brackets with inline array", "input": "\"has \\\"[2]\\\" in it\"[3]: 3,4,5", "expected": { "has \"[2]\" in it": [ From 8307d16ba1d895cf537da8bf5a7ec18fbbdff751 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Mon, 5 Oct 2026 08:32:23 +0200 Subject: [PATCH 22/24] test: note why an escaped quote keeps the brackets inside the key --- tests/fixtures/decode/arrays-primitive.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/fixtures/decode/arrays-primitive.json b/tests/fixtures/decode/arrays-primitive.json index 89aef8e..fd5f610 100644 --- a/tests/fixtures/decode/arrays-primitive.json +++ b/tests/fixtures/decode/arrays-primitive.json @@ -165,7 +165,8 @@ 5 ] }, - "specSection": "9.1" + "specSection": "9.1", + "note": "An escaped quote does not close a quoted key, so the [2] inside it is not a bracket segment" } ] } From 40538913813f76c3edbb2e147e30840390c76613 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Mon, 5 Oct 2026 08:32:23 +0200 Subject: [PATCH 23/24] test: reduce the tabular cell case to the header-shaped leading cell --- tests/fixtures/decode/arrays-tabular.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/fixtures/decode/arrays-tabular.json b/tests/fixtures/decode/arrays-tabular.json index b951cd4..64830aa 100644 --- a/tests/fixtures/decode/arrays-tabular.json +++ b/tests/fixtures/decode/arrays-tabular.json @@ -219,17 +219,13 @@ "minSpecVersion": "4.1" }, { - "name": "parses quoted structural strings in tabular cells", - "input": "rows[2]{note,id}:\n \"[2]: x\",1\n \"a: b, c\",2", + "name": "parses quoted leading tabular cell shaped like an inline array header", + "input": "rows[1]{note,id}:\n \"[2]: x\",1", "expected": { "rows": [ { "note": "[2]: x", "id": 1 - }, - { - "note": "a: b, c", - "id": 2 } ] }, From 2fb444e57ddd6d3935df773bdd940955d97c28c0 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Mon, 5 Oct 2026 08:32:23 +0200 Subject: [PATCH 24/24] test: shape the quoted key case like an inline array header --- tests/fixtures/decode/objects.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fixtures/decode/objects.json b/tests/fixtures/decode/objects.json index e0e72c2..af52a61 100644 --- a/tests/fixtures/decode/objects.json +++ b/tests/fixtures/decode/objects.json @@ -521,10 +521,10 @@ "specSection": "8" }, { - "name": "parses quoted key containing a bracket segment and colon", - "input": "\"k [2]: y\": 1", + "name": "parses quoted key shaped like an inline array header", + "input": "\"k[2]: y\": 1", "expected": { - "k [2]: y": 1 + "k[2]: y": 1 }, "specSection": "5.2" },