X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fstream.impure-cload.lisp;h=acfc2282927d022b79e1f0fef12410688865b5c7;hb=db0110475c0db5dc3cb1bb12de0b0c475880899e;hp=323881c30def2b010b92c9c129dc4926bec6f9a1;hpb=cf42b486323a8c50ee1d937ba3eee33777575905;p=sbcl.git diff --git a/tests/stream.impure-cload.lisp b/tests/stream.impure-cload.lisp index 323881c..acfc228 100644 --- a/tests/stream.impure-cload.lisp +++ b/tests/stream.impure-cload.lisp @@ -6,7 +6,7 @@ ;;;; While most of SBCL is derived from the CMU CL system, the test ;;;; files (like this one) were written from scratch after the fork ;;;; from CMU CL. -;;;; +;;;; ;;;; This software is in the public domain and is provided with ;;;; absolutely no warranty. See the COPYING and CREDITS files for ;;;; more information. @@ -28,37 +28,37 @@ (defparameter *scratch-file-name* "sbcl-wrapped-stream-test-data.tmp") (defvar *scratch-file-stream*) (dolist (scratch-file-length '(1 ; everyone's favorite corner case - 200123)) ; hopefully much bigger than buffer + 200123)) ; hopefully much bigger than buffer (format t "/SCRATCH-FILE-LENGTH=~W~%" scratch-file-length) (with-open-file (s *scratch-file-name* :direction :output) (dotimes (i scratch-file-length) (write-char #\x s))) (dolist (wrap-named-stream-fn - ;; All kinds of wrapped input streams have the same issue. - (list (lambda (wrapped-stream-name) - (make-synonym-stream wrapped-stream-name)) - (lambda (wrapped-stream-name) - (make-two-way-stream (symbol-value wrapped-stream-name) - *standard-output*)) - (lambda (wrapped-stream-name) - (make-concatenated-stream (symbol-value wrapped-stream-name) - (make-string-input-stream ""))))) + ;; All kinds of wrapped input streams have the same issue. + (list (lambda (wrapped-stream-name) + (make-synonym-stream wrapped-stream-name)) + (lambda (wrapped-stream-name) + (make-two-way-stream (symbol-value wrapped-stream-name) + *standard-output*)) + (lambda (wrapped-stream-name) + (make-concatenated-stream (symbol-value wrapped-stream-name) + (make-string-input-stream ""))))) (format t "/WRAP-NAMED-STREAM-FN=~S~%" wrap-named-stream-fn) (with-open-file (*scratch-file-stream* *scratch-file-name* - :direction :input) + :direction :input) (let ((ss (funcall wrap-named-stream-fn '*scratch-file-stream*))) - (flet ((expect (thing-expected) - (let ((thing-found (read-char ss nil nil))) - (unless (eql thing-found thing-expected) - (error "expected ~S, found ~S" - thing-expected thing-found))))) - (dotimes (i scratch-file-length) - (expect #\x) - (unread-char #\y ss) - (expect #\y) - (unread-char #\z ss) - (expect #\z)) - (expect nil))))) ; i.e. end of file + (flet ((expect (thing-expected) + (let ((thing-found (read-char ss nil nil))) + (unless (eql thing-found thing-expected) + (error "expected ~S, found ~S" + thing-expected thing-found))))) + (dotimes (i scratch-file-length) + (expect #\x) + (unread-char #\y ss) + (expect #\y) + (unread-char #\z ss) + (expect #\z)) + (expect nil))))) ; i.e. end of file (delete-file *scratch-file-name*)) (with-open-file (s *scratch-file-name* :direction :output)