diff --git a/src/Spec.ts b/src/Spec.ts index 11959311..1e3edebf 100644 --- a/src/Spec.ts +++ b/src/Spec.ts @@ -1624,6 +1624,12 @@ ${this.opts.multipage ? `
  • Navigate to/from multipagem { it('no contributors', async () => { @@ -932,4 +932,111 @@ ${M} { asImport: 'only' } ); }); + + describe('SDO defined over unknown production', () => { + it('unknown production', async () => { + await assertError( + positioned` + +

    Static Semantics: Example

    +
    + ${M} + Foo : \`a\` + + + 1. Return *true*. + +
    + `, + { + ruleId: 'grammar-shape', + nodeType: 'emu-grammar', + message: 'could not find definition corresponding to production Foo', + } + ); + }); + + it('unknown rhs', async () => { + await assertError( + positioned` + + Foo : \`b\` + + + +

    Static Semantics: Example

    +
    + ${M} + Foo : \`a\` + + + 1. Return *true*. + +
    + `, + { + ruleId: 'grammar-shape', + nodeType: 'emu-grammar', + message: 'could not find definition for rhs a', + } + ); + }); + + it('negative', async () => { + await assertErrorFree(` + + Foo : \`a\` + + + +

    Static Semantics: Example

    +
    + + Foo : \`a\` + + + 1. Return *true*. + +
    + `); + }); + + it('negative: external biblio', async () => { + let upstream = await emu.build( + 'root.html', + () => ` + + Foo : \`a\` + + `, + { + copyright: false, + location: 'https://example.com/spec/', + warn: e => { + console.error('Error:', e); + throw new Error(e.message); + }, + } + ); + let upstreamBiblio = upstream.exportBiblio(); + + await assertErrorFree( + ` + +

    Static Semantics: Example

    +
    + + Foo : \`a\` + + + 1. Return *true*. + +
    + `, + { + extraBiblios: [upstreamBiblio], + } + ); + }); + }); });