Skip to content

test(loop-sync): add CRLF frontmatter regression tests - #496

Open
pxmpsdev wants to merge 3 commits into
cobusgreyling:mainfrom
pxmpsdev:test/479-loop-sync-crlf-tests
Open

test(loop-sync): add CRLF frontmatter regression tests#496
pxmpsdev wants to merge 3 commits into
cobusgreyling:mainfrom
pxmpsdev:test/479-loop-sync-crlf-tests

Conversation

@pxmpsdev

Copy link
Copy Markdown
Contributor

Closes #479

Adds regression tests for extractFrontmatter CRLF handling (fixed in #476):

  • LF frontmatter still parses
  • CRLF frontmatter parses keys without trailing \r
  • ---hello (opening fence without newline) is rejected
  • Closing fence without newline is rejected

Exports extractFrontmatter from src/sync.ts so the tests can exercise it directly, and fixes a body-slicing off-by-one that the new tests exposed (the closing fence's newline was duplicated into the body).

cd tools/loop-sync && npm test passes (11 tests).

- body slice kept a leading newline (off-by-one) that duplicated the
  closing fence's own line break into the body
- a closing fence like '---oops' (no newline after it) was accepted as
  a valid frontmatter terminator
Export extractFrontmatter so the tests can exercise it directly. Covers
LF parsing, CRLF parsing without trailing CR, and rejection of opening
and closing fences without newlines.
@pxmpsdev
pxmpsdev force-pushed the test/479-loop-sync-crlf-tests branch from 2639491 to b3f16e8 Compare August 10, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CRLF frontmatter regression tests for loop-sync

1 participant