From: Nikodemus S. <de...@us...> - 2008-08-05 10:38:50
|
Update of /cvsroot/sbcl/sbcl/tests In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv26215/tests Modified Files: stream.impure.lisp Log Message: 1.0.19.22: fix bug #425 * Make CLOSE drop input buffers from ANSI-STREAMs. Reported by Damien Cassou on sbcl-devel. * Signal SB-INT:CLOSED-STREAM-ERROR instead of a SIMPLE-ERROR -- good for clarity, enables a proper test. Index: stream.impure.lisp =================================================================== RCS file: /cvsroot/sbcl/sbcl/tests/stream.impure.lisp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- stream.impure.lisp 15 Jun 2008 05:28:24 -0000 1.29 +++ stream.impure.lisp 5 Aug 2008 10:38:39 -0000 1.30 @@ -497,5 +497,24 @@ (multiple-value-list (read-line in nil nil)))))) (delete-file pathname) (assert (equal result '(("a" nil) ("b" t) (nil t)))))) + +;;; READ-LINE used to work on closed streams because input buffers were left in place +(with-test (:name :bug-425) + ;; Normal close + (let ((f (open "stream.impure.lisp" :direction :input))) + (assert (stringp (read-line f))) + (close f) + (assert (eq :fii + (handler-case + (read-line f) + (sb-int:closed-stream-error () :fii))))) + ;; Abort + (let ((f (open "stream.impure.lisp" :direction :input))) + (assert (stringp (read-line f nil nil))) + (close f :abort t) + (assert (eq :faa + (handler-case + (read-line f) + (sb-int:closed-stream-error () :faa)))))) ;;; success |