From 3149c002644b927e0245d237cdda3a6aeca00e4a Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sun, 16 Jun 2019 16:18:29 +0200 Subject: utils: canonical-newline-port: Fix handling of carriage return at buffer end. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prior to this change the added test fails for me locally at byte 1024. It might depend on some default buffer sizes. Fixes . * 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 --- tests/utils.scm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/utils.scm b/tests/utils.scm index 44861384ab..f78ec356bd 100644 --- a/tests/utils.scm +++ b/tests/utils.scm @@ -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" -- cgit v1.2.3