Skip to content

Add spec for newline detection - #210

Open
webdevred wants to merge 16 commits into
masterfrom
verify-newline-detection
Open

Add spec for newline detection#210
webdevred wants to merge 16 commits into
masterfrom
verify-newline-detection

Conversation

@webdevred

@webdevred webdevred commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Failing spec that defines the contract for a newline detector, ahead of the implementation (TDD).

test/Core/NewlineSpec.hs expects detectNewline :: Text -> Newline in JbeamEdit.Core.Newline, reusing base's System.IO.Newline (LF/CRLF) rather than a bespoke type. Cases: unix \n is LF, windows \r\n is CRLF, mixed endings are CRLF, and text without a line ending defaults to LF.

The suite does not compile until detectNewline exists, so this branch is red on purpose.

Relates to #209.

@webdevred
webdevred marked this pull request as ready for review August 8, 2026 21:56
hSetNewlineMode only applies to text-mode writes, so the ByteString
output went straight past it and every file came out with LF. Rewrite
the endings in the text instead.

Makes the ENABLE_WINDOWS_NEWLINES flag redundant.
The prefix had a stray g in it, so the branch never fired and a CRLF
file still lost the newline after the comment opener.
A newer local hpack rewrote the whole file, which the cabal file check
rejects. Only the windows newlines block should have gone.
It feeds the tool a blob but compares against the working tree, so the
two sides disagree about endings on Windows. The endings themselves have
their own check now.
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