Skip to content

fix: write non-ASCII test fixtures as JSON escape sequences - #1

Merged
pikann merged 1 commit into
mainfrom
fix/ensure-json-escape-sequences-for-non-ascii
Oct 3, 2026
Merged

pikann merged 1 commit into
mainfrom
fix/ensure-json-escape-sequences-for-non-ascii

Conversation

@pikann

@pikann pikann commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the failing CI on the initial commit (run 37125064280): the Test and Golden file matches BlockNote jobs both failed on the line_sep fixture.

Cause

line_sep exercises U+2028 / U+2029 (line and paragraph separators). Those were written as raw characters in testdata/blocknote_fixtures.json, and something in the toolchain stripped them, so the committed fixture silently became plain abc:

  • go test converted abc but the golden file expects a
b
c;
  • the JS check ran BlockNote on abc and got a different result from the golden file.

Lint passed. Nothing was wrong with the converter itself.

Changes

  • Fixtures (testdata/blocknote_fixtures.json): restore line_sep and rewrite the file with every non-ASCII character as a \uXXXX escape, so no editor or tool can strip one again.
  • Golden writer (js/golden.test.ts): escape U+2028, U+2029 and U+FEFF when writing testdata/blocknote_golden.json. JSON.stringify emits them raw, which is the same trap. Only two lines of the golden file change (raw characters become escapes); the converted output is identical.
  • Guard test (golden_test.go): TestFixturesAreASCII fails if the fixtures contain any raw non-ASCII byte, or if either testdata file contains a raw U+2028, U+2029 or U+FEFF. It immediately caught a second case, a raw U+FEFF in the golden file (the zero-width fixture), which is fixed here too.

Test plan

  • go test -race ./...
  • golangci-lint run
  • cd js && npm run golden (real BlockNote output matches the golden file)
  • CI green on this PR (Lint, Test, Golden file matches BlockNote)

🤖 Generated with Claude Code

@pikann pikann changed the title fix: ensure JSON escape sequences for non-ASCII characters in test fi… fix: write non-ASCII test fixtures as JSON escape sequences Oct 3, 2026
@pikann
pikann merged commit 25ee88f into main Oct 3, 2026
3 checks passed
@pikann
pikann deleted the fix/ensure-json-escape-sequences-for-non-ascii branch October 3, 2026 13:15
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.

1 participant