From 1785ec0a87ce92bb4dd8bba35c8ad4e79f004aa6 Mon Sep 17 00:00:00 2001 From: Montana Flynn Date: Thu, 21 May 2026 15:06:50 -0500 Subject: [PATCH] test: add nested empty-object list item fixtures --- CHANGELOG.md | 1 + tests/fixtures/decode/arrays-nested.json | 10 ++++++++++ tests/fixtures/encode/arrays-nested.json | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4582474..f429048 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - §7.1 ABNF `unescaped-char`: supplementary scalars (`%x10000-10FFFF`) included explicitly. - §13: option names and value tokens are concept handles; implementations MAY use language-idiomatic spellings or types. - Appendix F.5: informative Java mapping section. +- Test fixtures: nested expanded arrays containing empty object list items, confirming recursive bare-hyphen encoding/decoding per §9.4/§10. ### Changed diff --git a/tests/fixtures/decode/arrays-nested.json b/tests/fixtures/decode/arrays-nested.json index fad16f6..20f79f7 100644 --- a/tests/fixtures/decode/arrays-nested.json +++ b/tests/fixtures/decode/arrays-nested.json @@ -160,6 +160,16 @@ "expected": ["summary", { "id": 1, "name": "Ada" }, [{ "id": 2 }, { "status": "draft" }]], "specSection": "9.4" }, + { + "name": "parses nested arrays with empty object list items", + "input": "items[2]:\n - [1]:\n -\n - [2]:\n - x\n -", + "expected": { + "items": [[{}], ["x", {}]] + }, + "specSection": "9.4", + "minSpecVersion": "3.2", + "note": "The bare hyphen marker for an empty object list item applies recursively inside nested expanded arrays" + }, { "name": "parses root-level array of arrays", "input": "[2]:\n - [2]: 1,2\n - [0]:", diff --git a/tests/fixtures/encode/arrays-nested.json b/tests/fixtures/encode/arrays-nested.json index f414dc8..417c76a 100644 --- a/tests/fixtures/encode/arrays-nested.json +++ b/tests/fixtures/encode/arrays-nested.json @@ -59,6 +59,16 @@ "expected": "[3]:\n - summary\n - id: 1\n name: Ada\n - [2]:\n - id: 2\n - status: draft", "specSection": "9.4" }, + { + "name": "encodes nested arrays with empty object list items as bare hyphen", + "input": { + "items": [[{}], ["x", {}]] + }, + "expected": "items[2]:\n - [1]:\n -\n - [2]:\n - x\n -", + "specSection": "9.4", + "minSpecVersion": "3.2", + "note": "Nested non-primitive arrays use expanded list form per §9.4; empty object list items inside them still encode as a bare hyphen per §10, with no trailing space per §12" + }, { "name": "encodes root-level arrays of arrays", "input": [[1, 2], []],