Name the position a directive name the other one spells belongs to
CI / gate (push) Successful in 8s

This commit is contained in:
2026-09-01 23:04:23 +02:00
parent 1429f4ce3c
commit 5defa89b8d
7 changed files with 55 additions and 4 deletions
+7
View File
@@ -8,6 +8,7 @@ import type { AttributeKind, AttributeVocabulary } from './adf/attribute-vocabul
import { blockDirectives } from './adf/block-directives.ts'
import { inlineDirectives } from './adf/inline-directives.ts'
import { markAttributes } from './adf/mark-attributes.ts'
import { textDirectiveName } from './markdown/text-directive.ts'
type Declared = { attributes: AttributeVocabulary }
@@ -96,6 +97,12 @@ test('the inline node table holds the attributes spec/flavour.md gives each node
assert.deepEqual(declarations('Inline nodes'), vocabularies(inlineDirectives))
})
// A name in two tables would make the position a directive is read in ambiguous.
test('no name is spelled in more than one position', () => {
const names = [...Object.keys(blockDirectives), ...Object.keys(inlineDirectives), ...Object.keys(markAttributes), textDirectiveName]
assert.equal(new Set(names).size, names.length)
})
test('the mark table holds the attributes spec/flavour.md gives each mark', () => {
assert.deepEqual(declarations('Marks'), vocabularies(Object.fromEntries(Object.entries(markAttributes).map(([type, attributes]) => [type, { attributes }]))))
})