Fix CRLF handling in IO functions #649
Merged
+103
−61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #648
\rwere read as\nwhen CRLF decoding is enabled; this bug exists since forever (16 years ago):text/Data/Text/IO.hs
Line 169 in 239c508
\nwas not encoded as\r\nwhen we were at the end of a buffer (bug introduced in Fixed off by one for writeBlocksRaw #590, included in text-2.1.2)Also improve the "input-output" property test to catch these mistakes (in addition to a dedicated regression test): force the use of a smaller buffer to trigger boundary conditions more easily; explicitly inspect the CRLF encoding.
And to reduce the number of test names, instead of listing all combinations of encodings and buffering modes as individual tests, they are merged into a single test that picks encodings and buffering modes randomly.