1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-24 12:20:20 +02:00

Revert "Handle CRLF and Unicode line endings in read-line"

This reverts commit 0f983e3db0.

After discussing with Mike we are going to punt the read-line changes
for now.  Open the port in O_TEXT mode if you want to chomp the CR in
CFLF sequences.
This commit is contained in:
Andy Wingo 2021-03-12 22:06:56 +01:00
parent 1c472fef54
commit e30ee90478
6 changed files with 25 additions and 171 deletions

View file

@ -1,7 +1,7 @@
;;;; rdelim.test --- Delimited I/O. -*- mode: scheme; coding: utf-8; -*-
;;;; Ludovic Courtès <ludo@gnu.org>
;;;;
;;;; Copyright (C) 2011, 2013, 2014, 2021 Free Software Foundation, Inc.
;;;; Copyright (C) 2011, 2013, 2014 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -62,46 +62,6 @@
(read-line p 'split)))
(eof-object? (read-line p)))))
(pass-if "two lines, split, CRLF"
(let* ((s "foo\r\nbar\r\n")
(p (open-input-string s)))
(and (equal? '(("foo" . "\r\n")
("bar" . "\r\n"))
(list (read-line p 'split)
(read-line p 'split)))
(eof-object? (read-line p)))))
(pass-if "two long lines, split, CRLF"
;; Must be longer than 256 codepoints
(let* ((text0 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
(text1 (string-append text0 text0 text0 text0 text0))
(text2 (string-append text1 "\r\n" text1 "\r\n")))
(let* ((s text2)
(p (open-input-string s)))
(and (equal? `((,text1 . "\r\n")
(,text1 . "\r\n"))
(list (read-line p 'split)
(read-line p 'split)))
(eof-object? (read-line p))))))
(pass-if "two lines, split, LS"
(let* ((s "foo\u2028bar\u2028")
(p (open-input-string s)))
(and (equal? '(("foo" . #\x2028)
("bar" . #\x2028))
(list (read-line p 'split)
(read-line p 'split)))
(eof-object? (read-line p)))))
(pass-if "two lines, split, PS"
(let* ((s "foo\u2029bar\u2029")
(p (open-input-string s)))
(and (equal? '(("foo" . #\x2029)
("bar" . #\x2029))
(list (read-line p 'split)
(read-line p 'split)))
(eof-object? (read-line p)))))
(pass-if "two Greek lines, trim"
(let* ((s "λαμβδα\nμυ\n")
(p (open-input-string s)))