Commit d65009d6 authored by pfdietz's avatar pfdietz

Refactored DESCRIBE tests

parent 72194dfe
......@@ -5,25 +5,27 @@
(in-package :cl-test)
(defun harness-for-describe (fn)
(let (s1 s2)
(with-open-stream
(*standard-output* (make-string-output-stream))
(with-open-stream
(tio-input (make-string-input-stream "X"))
(with-open-stream
(tio-output (make-string-output-stream))
(with-open-stream
(*terminal-io* (make-two-way-stream tio-input tio-output))
(let ((*print-circle* t)
(*print-readably* nil))
(assert (null (multiple-value-list (funcall fn))))))
(setq s2 (get-output-stream-string tio-output)))
(assert (equal (read-char tio-input) #\X)))
(setq s1 (get-output-stream-string *standard-output*)))
(values s1 s2)))
(deftest describe.1
(loop for x in *universe*
for s1 = nil
for s2 = nil
do
(with-open-stream
(*standard-output* (make-string-output-stream))
(with-open-stream
(tio-input (make-string-input-stream "X"))
(with-open-stream
(tio-output (make-string-output-stream))
(with-open-stream
(*terminal-io* (make-two-way-stream tio-input tio-output))
(let ((*print-circle* t)
(*print-readably* nil))
(assert (null (multiple-value-list (describe x))))))
(setq s2 (get-output-stream-string tio-output)))
(assert (equal (read-char tio-input) #\X)))
(setq s1 (get-output-stream-string *standard-output*)))
for (s1 s2) = (multiple-value-list (harness-for-describe #'(lambda () (describe x))))
when (and (equal s1 "") (equal s2 ""))
collect x)
nil)
......@@ -32,69 +34,21 @@
(loop for x in *universe*
for s1 = nil
for s2 = nil
for s3 =
(with-output-to-string
(s)
(with-open-stream
(*standard-output* (make-string-output-stream))
(with-open-stream
(tio-input (make-string-input-stream "X"))
(with-open-stream
(tio-output (make-string-output-stream))
(with-open-stream
(*terminal-io* (make-two-way-stream tio-input tio-output))
(let ((*print-circle* t)
(*print-readably* nil))
(assert (null (multiple-value-list (describe x s))))))
(setq s2 (get-output-stream-string tio-output)))
(assert (equal (read-char tio-input) #\X)))
(setq s1 (get-output-stream-string *standard-output*))))
for s3 = (with-output-to-string (s) (setf (values s1 s2) (harness-for-describe #'(lambda () (describe x s)))))
when (or (equal s3 "") (not (equal "" s2)) (not (equal "" s1)))
collect (list x s1 s2 s3))
nil)
(deftest describe.3
(loop for x in *universe*
for s1 = nil
for s2 = nil
do
(with-open-stream
(*standard-output* (make-string-output-stream))
(with-open-stream
(tio-input (make-string-input-stream "X"))
(with-open-stream
(tio-output (make-string-output-stream))
(with-open-stream
(*terminal-io* (make-two-way-stream tio-input tio-output))
(let ((*print-circle* t)
(*print-readably* nil))
(assert (null (multiple-value-list (describe x t))))))
(setq s2 (get-output-stream-string tio-output)))
(assert (equal (read-char tio-input) #\X)))
(setq s1 (get-output-stream-string *standard-output*)))
for (s1 s2) = (multiple-value-list (harness-for-describe #'(lambda () (describe x t))))
when (or (equal "" s2) (not (equal "" s1)))
collect (list x s1 s2))
nil)
(deftest describe.4
(loop for x in *universe*
for s1 = nil
for s2 = nil
do
(with-open-stream
(*standard-output* (make-string-output-stream))
(with-open-stream
(tio-input (make-string-input-stream "X"))
(with-open-stream
(tio-output (make-string-output-stream))
(with-open-stream
(*terminal-io* (make-two-way-stream tio-input tio-output))
(let ((*print-circle* t)
(*print-readably* nil))
(assert (null (multiple-value-list (describe x nil))))))
(setq s2 (get-output-stream-string tio-output)))
(assert (equal (read-char tio-input) #\X)))
(setq s1 (get-output-stream-string *standard-output*)))
for (s1 s2) = (multiple-value-list (harness-for-describe #'(lambda () (describe x nil))))
when (or (equal "" s1) (not (equal "" s2)))
collect (list x s1 s2))
nil)
......
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