X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fstream.pure.lisp;h=64747589710aa492c667c2af521e725f46fe5179;hb=079ef9dad558ca07cb8178ef428bf738112174fa;hp=94da3afa849a317988e1b31248d05351f1a53043;hpb=15e14ef1ccd3ab6f4711632435a40493dc4cdd9d;p=sbcl.git diff --git a/tests/stream.pure.lisp b/tests/stream.pure.lisp index 94da3af..6474758 100644 --- a/tests/stream.pure.lisp +++ b/tests/stream.pure.lisp @@ -242,3 +242,30 @@ (with-open-file (s "/dev/null" :element-type '(signed-byte 48)) (assert (eq :eof (read-byte s nil :eof)))) + +(let* ((is (make-string-input-stream "foo")) + (os (make-string-output-stream)) + (s (make-echo-stream is os)) + (sequence (copy-seq "abcdef"))) + (assert (= (read-sequence sequence s) 3)) + (assert (string= sequence "foodef")) + (assert (string= (get-output-stream-string os) "foo"))) + +(let* ((is (make-string-input-stream "foo")) + (os (make-string-output-stream)) + (s (make-echo-stream is os)) + (sequence (copy-seq "abcdef"))) + (assert (char= #\f (read-char s))) + (assert (= (read-sequence sequence s) 2)) + (assert (string= sequence "oocdef")) + (assert (string= (get-output-stream-string os) "foo"))) + +(let* ((is (make-string-input-stream "foo")) + (os (make-string-output-stream)) + (s (make-echo-stream is os)) + (sequence (copy-seq "abcdef"))) + (assert (char= #\f (read-char s))) + (unread-char #\f s) + (assert (= (read-sequence sequence s) 3)) + (assert (string= sequence "foodef")) + (assert (string= (get-output-stream-string os) "foo")))