Commit 06488b85 authored by Daniel Kochmański's avatar Daniel Kochmański
Browse files

Merge branch 'broadcast-streams' into 'master'

streams: add 4 new tests for broadcast and string-output streams

See merge request ansi-test/ansi-test!15
parents e5677433 6fb386df
......@@ -15,6 +15,34 @@
(list *standard-output*))
t)
;;; Ensure that the last component is taken for
;;; file-{position,length,string-length} functions.
(deftest broadcast-stream-streams.3
(let ((first-stream (make-string-output-stream)))
(with-open-file (last-stream "bss-last.txt"
:direction :output
:if-exists :supersede
:if-does-not-exist :create)
(format last-stream "Hello world!~%")
(finish-output last-stream) ; for buffered streams
(let ((broadcast (make-broadcast-stream first-stream last-stream)))
(values
(= 13 (file-length last-stream))
(= 13 (file-length broadcast) (file-length last-stream))
(= 13 (file-position broadcast) (file-position last-stream))
(= 2
(file-string-length broadcast "jd")
(file-string-length last-stream "jd"))))))
t t t t)
(deftest broadcast-stream-streams.4
(let ((stream (make-broadcast-stream)))
(values (= 0 (file-length stream))
(= 0 (file-position stream))
(= 1 (file-string-length stream "foo"))
(eq :default (stream-external-format stream))))
t t t t)
(deftest broadcast-stream-streams.error.1
(signals-error (broadcast-stream-streams) program-error)
t)
......@@ -23,8 +51,3 @@
(signals-error (broadcast-stream-streams (make-broadcast-stream) nil)
program-error)
t)
......@@ -134,6 +134,8 @@
program-error)
t)
(deftest make-string-output-stream.error.4
(signals-error (file-length (make-string-output-stream)) type-error)
T)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment