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);