1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 13:10:33 +02:00

utils: canonical-newline-port: Fix handling of carriage return at buffer end.

Prior to this change the added test fails for me locally at byte
1024. It might depend on some default buffer sizes.

Fixes <https://bugs.gnu.org/35863>.

* tests/utils.scm ("canonical-newline-port-1024"): Add test.
* guix/utils.scm (canonical-newline-port): Correct comments on CR/LF.
Remove CR even when they're at the end of the buffer.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Robert Vollmert
2019-06-16 16:18:29 +02:00
committed by Ludovic Courtès
parent c050f18700
commit 3149c00264
2 changed files with 9 additions and 3 deletions

View File

@@ -230,6 +230,12 @@ skip these tests."
"This is a journey\r\nInto the sound\r\nA journey ...\n")))
(get-string-all (canonical-newline-port port))))
(test-equal "canonical-newline-port-1024"
(string-concatenate (make-list 100 "0123456789abcde\n"))
(let ((port (open-string-input-port
(string-concatenate
(make-list 100 "0123456789abcde\r\n")))))
(get-string-all (canonical-newline-port port))))
(test-equal "edit-expression"
"(display \"GNU Guix\")\n(newline)\n"