#1285·eino

components/document/parser: TestParser fails on Windows checkouts with core.autocrlf=true (CRLF in testdata)

Author: fszcdCreated Sep 13, 2026Updated Sep 13, 2026

Describe the bug

go test ./components/document/parser/ fails on a Windows host that uses Git's default Windows configuration (core.autocrlf=true):

--- FAIL: TestParser (0.00s)
    --- FAIL: TestParser/Test_default_parser (0.00s)
        parser_test.go:61:
                Error:      Not equal:
                            expected: "# Title\nhello world"
                            actual  : "# Title\r\nhello world"

Root cause

TestParser/Test_default_parser parses the checked-in components/document/parser/testdata/test.md and asserts its exact content ("# Title\nhello world"). With core.autocrlf=true — the default of the standard Git for Windows installer — the working-tree copy of testdata/test.md is materialized with CRLF line endings, and TextParser (correctly) returns the file bytes verbatim, so the assertion fails. The outcome of the test therefore depends on the contributor's local git configuration rather than on the code under test.

CI only runs on ubuntu-latest, so this is invisible upstream.

Expected behavior

The test should pass regardless of how git materialized line endings in the working tree. It can be made hermetic by writing the markdown fixture itself with explicit LF bytes (into t.TempDir()) instead of reading a checked-in testdata file for the content assertion.

Environment

bash
go version go1.27.1 windows/amd64
git config core.autocrlf=true (Git for Windows default)

A PR with the hermetic-fixture change follows.