X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fstream.pure.lisp;h=64747589710aa492c667c2af521e725f46fe5179;hb=4c5a011ccc355e3653b9490de6a2b3df5777e55d;hp=127333b5c5ef6fc87056595e543ffc419c76ec2a;hpb=954902abeb19dac4f79f0a5b800eac45179b8d7c;p=sbcl.git diff --git a/tests/stream.pure.lisp b/tests/stream.pure.lisp index 127333b..6474758 100644 --- a/tests/stream.pure.lisp +++ b/tests/stream.pure.lisp @@ -160,13 +160,14 @@ ;;; the end of string and the string is adjustable the string will be ;;; implicitly extended, otherwise an error will be signalled. The ;;; latter case is provided for in the code, but not currently -;;; excercised since SBCL fill-pointer arrays are always (currently) adjustable. +;;; excercised since SBCL fill-pointer arrays are always (currently) +;;; adjustable. ;;; ;;; * END will refer to the ARRAY-TOTAL-SIZE of string, not ;;; FILL-POINTER, since by definition the FILE-POSITION will always be ;;; a FILL-POINTER, so that would be of limited use. ;;; -;;; * Rewinding the stream works with owerwriting semantics. +;;; * Rewinding the stream works with overwriting semantics. ;;; #+nil (let ((str (make-array 0 :element-type 'character @@ -238,3 +239,33 @@ (frob 'character) (frob 'base-char) (frob 'nil)) + +(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")))