Add a regression test for the bug described in #576

Merge a test for with-output-to-string with the one for
with-input-input-from-string to ensure both close their streams.

Remove check for stream-var being a stream outside of w-i-f-s &
w-o-t-s. According to the specification, the streams' extent ends with the
respective providing form. If the stream was indeed not acccessible anymore, the
test would not pass. In that case open-stream-p should signal a type-error,
causing the test to crash. However in ECL we can assume that the stream is still
intact.
This commit is contained in:
Moritz Petersen 2020-04-22 22:03:14 +02:00 committed by Daniel Kochmański
parent 660b1bec69
commit d5eafde045

View file

@ -374,16 +374,20 @@
(signals ext:stack-overflow (labels ((f (x) (f (1+ x))))
(f 1))))
;;; Date 2020-04-18
;;; Date 2020-04-22
;;; URL: https://gitlab.com/embeddable-common-lisp/ecl/-/merge_requests/197
;;; URL: https://gitlab.com/embeddable-common-lisp/ecl/-/issues/576
;;; Description:
;;;
;;; Ensure that with-input-from-string closes the input stream
;;; that it creates.
(test mix.0019.close-with-input-from-string-stream
;;; Ensure that with-input-from-string and with-output-to-string
;;; close the streams that they provide.
(test mix.0019.with-string-io-close-streams
(let (stream-var)
(with-input-from-string (inner-stream-var "test")
(setf stream-var inner-stream-var)
(is (open-stream-p stream-var)))
(is (streamp stream-var))
(is (not (open-stream-p stream-var)))
(with-output-to-string (inner-stream-var)
(setf stream-var inner-stream-var)
(is (open-stream-p stream-var)))
(is (not (open-stream-p stream-var)))))