From 1ad4b73c9a39d32f4f512c114f1152ab41179511 Mon Sep 17 00:00:00 2001 From: c0dev0id Date: Mon, 6 Jul 2026 21:08:40 +0200 Subject: [PATCH] test: add coverage for unknownSlots graceful degradation --- test-parser.mjs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test-parser.mjs b/test-parser.mjs index 1c2aab2..599e694 100644 --- a/test-parser.mjs +++ b/test-parser.mjs @@ -666,6 +666,20 @@ ok('adjacent: null when absent', adjOffset.stemNotes[0].adjacent === null); ok('adjacent: false when False', adjOffset.stemNotes[1].adjacent === false); ok('adjacent: true when True', adjOffset.stemNotes[2].adjacent === true); +section('unknownSlots graceful degradation'); +const UNK_FIXTURE = `00 instrument 'test' +01 character.FUTURE_SLOT foo='bar' +01 character.variation +02 variation.ANOTHER_UNKNOWN x=1 +`; +const unkModel = buildModel(parseAstLog(UNK_FIXTURE)); +const unkInstr = unkModel.instruments[0]; +ok('unknown slot: instrument parsed', !!unkInstr); +ok('unknown slot: rawChildren is array', Array.isArray(unkInstr.rawChildren)); +ok('unknown slot: instrument-level unknown collected', unkInstr.rawChildren.length === 1); +ok('unknown slot: collected slot type', unkInstr.rawChildren[0].type === 'FUTURE_SLOT'); +ok('variation-level unknown collected', unkInstr.variations[0]?.rawChildren?.length === 1); + section('Full fixture integration'); ok('fixture parses without error (checked above)', raw && raw.slot === 'root'); ok('fixture has 432 bars', model.bars.length === 432);