Skip to content

test: close corpus coverage gaps and make fixtures self-describing - #192

Merged
Azganoth merged 2 commits into
mainfrom
chore/corpus-coverage-gaps
Aug 11, 2026
Merged

test: close corpus coverage gaps and make fixtures self-describing#192
Azganoth merged 2 commits into
mainfrom
chore/corpus-coverage-gaps

Conversation

@Azganoth

Copy link
Copy Markdown
Owner

Summary

Audited corpus/ against CommonMark 0.31.2, the GFM extension sections, and Typora's documented HTML support, then closed the gaps the audit found.

Coverage:

  • HTML block conditions: type 6 interrupts a paragraph while type 7 does not; a blank line survives <script>, <style>, and <!-- but ends <section> and <details>; closing tag as block start; multi-line, unquoted, and single-quoted attributes; mismatched inline tags; event-handler attributes.
  • Containers: laziness cannot begin a new block; list item beginning with a blank line; empty item cannot interrupt a paragraph.
  • Reference definitions: forward-referenced and never-referenced.
  • Tables: header-only, pipes without a delimiter row, unescaped pipe in a code span, tables inside a list and a blockquote.
  • Line breaks: trailing whitespace that is not a hard break.
  • Fences: a backtick in a backtick info string.
  • New isolated and boundary fixtures: unclosed frontmatter, unclosed HTML block at EOF, an invalid UTF-8 byte, and long lines.
  • New practical/round-trip.md for serialization normalization, including the delimiter-only, destination-only, title-only, and partial-reference selections named in the specification.
  • Security-shaped destinations: javascript: and data: in autolink, inline-link, and image position; an entity-obfuscated scheme; raw-HTML img/video/audio/iframe/embed relative sources.

Cuts:

  • Duplicate backslash-escape run in stress.md, already identical to the one in commonmark/text-and-breaks.md.
  • extensions/fenced-diagrams.md, whose entire content is one fenced block with an info string that commonmark/code.md already covers.
  • An unintended [reference] label collision between two sections of interactions.md, where the second section resolved through the first definition and demonstrated the opposite of its heading.

Convention:

  • Multi-case fixtures now name their own expected state, matching the style already dominant in the corpus. The rule is recorded in corpus/README.md, with a line separating it from the existing prohibition on embedded expected HTML and parser assertions.

Typora-derived HTML content stays in commonmark/html.md rather than moving to extensions/. Every tag Typora documents is already CommonMark raw HTML, so filing it as deliberately nonstandard syntax would assert something false about standard syntax. Because the app displays raw HTML as literal text, the per-tag rendering distinctions collapse into one behavior, so the new fixtures are framed by block condition and end condition instead of by tag. The video/audio/iframe embeds are the exception and went to environment/asset-handoff.md, where local-resource resolution is already covered.

Related Issue

Not applicable.

Verification

No automated test references corpus/, so pnpm check is unaffected by this change.

Targeted validation:

  1. corpus/boundaries/bytes/invalid-utf8.md still contains the raw 0xFF byte after staging and after the pre-commit hook, confirmed with od -c against both the working tree and the staged blob.
  2. The single trailing space in corpus/commonmark/text-and-breaks.md and the two trailing spaces at the end of its adjacent paragraph survive the pre-commit hook, confirmed with cat -A.
  3. oxfmt matches zero Markdown files, so lint-staged cannot rewrite the whitespace- and byte-sensitive fixtures.
  4. corpus/boundaries/limits/long-line.md holds lines of 22499, 5000, and 2012 characters.

Not verified: none of the new fixtures were opened in the running app. The CommonMark outcomes written into the rewritten emphasis fixtures were derived by hand rather than checked against a reference implementation.

Notes

The audit's rejected proposals are deliberate omissions rather than oversights: per-tag fixtures for the inline tags Typora documents, <pre> and <textarea> block fixtures, the emphasis multiple-of-three cases, and a corpus/security/ directory. The last one would sort fixtures by threat model while every other directory sorts by defining specification, and would require duplicating content to keep either axis complete.

Two proposed cuts were dropped on a second look. boundaries/bytes/delete.md and unit-separator.md exercise one CommonMark decision between them but may diverge in a text-shaping layer, and trimming the length-2 cases from the opening-only backtick section removes coverage to save four lines.

…aries

Typora-derived HTML fixtures stay in commonmark/html.md rather than moving to
extensions/. Every tag Typora documents is already CommonMark raw HTML, so
filing them as deliberately nonstandard syntax would assert something false
about standard syntax. Displaying raw HTML as literal text also collapses the
per-tag rendering distinctions into one behavior, so the new fixtures are
framed by block condition and end condition instead of by tag.

The [reference] label in interactions.md was defined twice. The second section
resolved through the first definition and so demonstrated the opposite of its
heading.

fenced-diagrams.md is dropped. Its entire content is one fenced block with an
info string, already covered by commonmark/code.md, and diagram rendering is
outside the supported set.
Most of the corpus already writes the expected behavior into the fixture
content, as in `*asterisk opens but underscore closes_`. The sections that used
alpha/foo/A-B placeholders instead left a reader deriving from the
specification which of several cases under one heading did what.

Recording the convention in the README needs a line separating it from the
existing rule against embedded expected HTML and parser assertions. Naming a
delimiter outcome in prose is a description a manual tester compares the
rendering against, not machine-checked output.

The "Rule of three" heading named a specification rule rather than the
behavior under inspection, and named the wrong rule for the cases beneath it.
@Azganoth Azganoth self-assigned this Aug 11, 2026
@Azganoth Azganoth added the Maintenance Chore, refactor, dependency, or test work without user-facing change label Aug 11, 2026
@Azganoth
Azganoth enabled auto-merge (squash) August 11, 2026 04:59
@Azganoth
Azganoth merged commit 22ef0a8 into main Aug 11, 2026
3 checks passed
@Azganoth
Azganoth deleted the chore/corpus-coverage-gaps branch August 11, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Maintenance Chore, refactor, dependency, or test work without user-facing change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant