1 ;;;; tests related to Lisp streams
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
16 (load "assertoid.lisp")
18 ;;; type errors for inappropriate stream arguments, fixed in
21 (declare (optimize (safety 3)))
22 (assert (raises-error?
(make-two-way-stream (make-string-output-stream)
23 (make-string-output-stream))
25 (assert (raises-error?
(make-two-way-stream (make-string-input-stream "foo")
26 (make-string-input-stream "bar"))
28 ;; the following two aren't actually guaranteed, because ANSI, as it
29 ;; happens, doesn't say "should signal an error" for
30 ;; MAKE-ECHO-STREAM. It's still good to have, but if future
31 ;; maintenance work causes this test to fail because of these
32 ;; MAKE-ECHO-STREAM clauses, consider simply removing these clauses
33 ;; from the test. -- CSR, 2002-10-06
34 (assert (raises-error?
(make-echo-stream (make-string-output-stream)
35 (make-string-output-stream))
37 (assert (raises-error?
(make-echo-stream (make-string-input-stream "foo")
38 (make-string-input-stream "bar"))
40 (assert (raises-error?
(make-concatenated-stream
41 (make-string-output-stream)
42 (make-string-input-stream "foo"))
45 ;;; bug 225: STRING-STREAM was not a class
46 (eval `(defgeneric bug225
(s)
47 ,@(mapcar (lambda (class)
48 `(:method
:around
((s ,class
)) (cons ',class
(call-next-method))))
49 '(stream string-stream sb-impl
::string-input-stream
50 sb-impl
::string-output-stream
))
51 (:method
(class) nil
)))
53 (assert (equal (bug225 (make-string-input-stream "hello"))
54 '(sb-impl::string-input-stream string-stream stream
)))
55 (assert (equal (bug225 (make-string-output-stream))
56 '(sb-impl::string-output-stream string-stream stream
)))
60 (quit :unix-status
104)