Commit 4b153a45 authored by pfdietz's avatar pfdietz

Added my-with-standard-io-syntax to some of the tests

parent 1965fff5
......@@ -14,9 +14,7 @@
nconc
(and (not (listp obj))
(let ((s1 (write-to-string obj))
(s2 (with-output-to-string (s) (assert (equal (multiple-value-list
(pprint-fill s obj))
'(nil))))))
(s2 (with-output-to-string (s) (pprint-fill s obj))))
(unless (equal s1 s2)
(list (list obj s1 s2))))))))
nil)
......@@ -29,22 +27,19 @@
nconc
(and (not (listp obj))
(let ((s1 (write-to-string obj))
(s2 (with-output-to-string (s) (assert (equal (multiple-value-list
(pprint-fill s obj))
'(nil))))))
(s2 (with-output-to-string (s) (pprint-fill s obj))))
(unless (equal s1 s2)
(list (list obj s1 s2))))))))
nil)
(defmacro def-pprint-fill-test (name args expected-value &key (margin 100) (circle nil))
`(deftest ,name
(let ((*print-pretty* t)
(*print-readably* nil)
(*print-right-margin* ,margin)
(*print-circle* ,circle))
(with-output-to-string
(s)
(assert (equal '(nil) (multiple-value-list (pprint-fill s ,@args))))))
(my-with-standard-io-syntax
(let ((*print-pretty* t)
(*print-readably* nil)
(*print-right-margin* ,margin)
(*print-circle* ,circle))
(with-output-to-string (s) (pprint-fill s ,@args))))
,expected-value))
(def-pprint-fill-test pprint-fill.3 ('(cl-user::|A|)) "(A)")
......@@ -134,6 +129,24 @@
(def-pprint-fill-test pprint-fill.14 ((let ((x (list 'CL-USER::|A|))) (list x x)))
"(#1=(A) #1#)" :circle t)
;;; Test that pprint-fill returns NIL
(deftest pprint-fill.return-values.1
(my-with-standard-io-syntax
(let ((*print-pretty* nil)
(*package* (find-package "CL-TEST")))
(with-open-stream (s (make-broadcast-stream))
(pprint-fill s '(a b)))))
nil)
(deftest pprint-fill.return-values.2
(my-with-standard-io-syntax
(let ((*print-pretty* nil)
(*package* (find-package :cl-test)))
(with-open-stream (s (make-broadcast-stream))
(pprint-fill s 10 nil t))))
nil)
;;; Error tests
(deftest pprint-fill.error.1
......@@ -147,8 +160,3 @@
(deftest pprint-fill.error.3
(signals-error (pprint-fill *standard-output* nil t t t) program-error)
t)
......@@ -38,13 +38,14 @@
(defmacro def-pprint-linear-test (name args expected-value &key (margin 100) (circle nil))
`(deftest ,name
(let ((*print-pretty* t)
(*print-readably* nil)
(*print-right-margin* ,margin)
(*print-circle* ,circle))
(with-output-to-string
(s)
(assert (equal '(nil) (multiple-value-list (pprint-linear s ,@args))))))
(my-with-standard-io-syntax
(let ((*print-pretty* t)
(*print-readably* nil)
(*print-right-margin* ,margin)
(*print-circle* ,circle))
(with-output-to-string
(s)
(pprint-linear s ,@args))))
,expected-value))
(def-pprint-linear-test pprint-linear.3 ('(cl-user::|A|)) "(A)")
......@@ -141,5 +142,3 @@
(deftest pprint-linear.error.3
(signals-error (pprint-linear *standard-output* nil t t t) program-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