diff --git a/ansi-tests/print-cons.lsp b/ansi-tests/print-cons.lsp index 4798cb8daf302f69c319adbc8f37f088775a3607..a156e07c6672ed1c69a5cd716b327b24e5d48001 100644 --- a/ansi-tests/print-cons.lsp +++ b/ansi-tests/print-cons.lsp @@ -8,44 +8,51 @@ (in-package :cl-test) (deftest print.cons.1 - (with-standard-io-syntax - (write-to-string '(|A|) :case :upcase :pretty nil :escape nil :readably nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(|A|) :case :upcase :pretty nil :escape nil))) "(A)") (deftest print.cons.2 - (with-standard-io-syntax - (write-to-string '(|A| |B|) :case :upcase :pretty nil :escape nil :readably nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(|A| |B|) :case :upcase :pretty nil :escape nil))) "(A B)") (deftest print.cons.3 - (with-standard-io-syntax - (write-to-string (cons '|A| '|B|) :case :upcase :pretty nil :escape nil :readably nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string (cons '|A| '|B|) :case :upcase :pretty nil :escape nil))) "(A . B)") (deftest print.cons.4 - (with-standard-io-syntax - (write-to-string (let ((s '#:|X|)) (cons s s)) :case :upcase :pretty nil :escape t :readably nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string (let ((s '#:|X|)) (cons s s)) :case :upcase :pretty nil :escape t))) "(#:X . #:X)") (deftest print.cons.5 - (with-standard-io-syntax - (write-to-string (let ((s '#:|X|)) (cons s s)) :case :upcase :pretty nil :escape t :circle t :readably nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string (let ((s '#:|X|)) (cons s s)) :case :upcase :pretty nil :escape t :circle t))) "(#1=#:X . #1#)") (deftest print.cons.6 - (with-standard-io-syntax - (write-to-string (let ((s1 (make-symbol "X")) - (s2 (make-symbol "X"))) - (list s1 s2 s1 s2)) - :case :upcase :pretty nil :escape t :circle t :readably nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string (let ((s1 (make-symbol "X")) + (s2 (make-symbol "X"))) + (list s1 s2 s1 s2)) + :case :upcase :pretty nil :escape t :circle t))) "(#1=#:X #2=#:X #1# #2#)") (deftest print.cons.7 - (with-standard-io-syntax - (write-to-string (let ((a (list 17 nil))) - (setf (cdr a) a) - a) - :circle t :pretty nil :escape nil :readably nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string (let ((a (list 17 nil))) + (setf (cdr a) a) + a) + :circle t :pretty nil :escape nil))) "#1=(17 . #1#)") ;;; Random printing @@ -63,7 +70,7 @@ (let ((x '`(a ,b ,@c (d . ,e) ,.f #(1 2 ,p ,@q ,.r s) g))) (loop repeat 20 - nconc (randomly-check-readability x))) + nconc (randomly-check-readability x :test #'is-similar))) nil) ;; random circular cons graphs @@ -85,79 +92,85 @@ ;;; Printing with *print-length* (deftest print.cons.length.1 - (with-standard-io-syntax - (write-to-string '(a) :length 0 :readably nil :pretty nil :escape nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(a) :length 0 :pretty nil :escape nil))) "(...)") (deftest print.cons.length.2 - (with-standard-io-syntax - (write-to-string '(81) :length 1 :readably nil :pretty nil :escape nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(81) :length 1 :pretty nil :escape nil))) "(81)") (deftest print.cons.length.3 - (with-standard-io-syntax - (write-to-string '(4 . 8) :length 1 :readably nil :pretty nil :escape nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(4 . 8) :length 1 :pretty nil :escape nil))) "(4 . 8)") (deftest print.cons.length.4 - (with-standard-io-syntax - (write-to-string '(4 8) :length 1 :readably nil :pretty nil :escape nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(4 8) :length 1 :pretty nil :escape nil))) "(4 ...)") (deftest print.cons.length.5 - (with-standard-io-syntax - (write-to-string '(a b c d e f g h i j k l m n o p) - :case :downcase :length 10 - :readably nil :pretty nil :escape nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(a b c d e f g h i j k l m n o p) + :case :downcase :length 10 + :pretty nil :escape nil))) "(a b c d e f g h i j ...)") (deftest print.cons.length.6 - (with-standard-io-syntax - (write-to-string '(((((((0))))))) - :case :downcase :length 3 - :readably nil :pretty nil :escape nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(((((((0))))))) + :case :downcase :length 3 + :pretty nil :escape nil))) "(((((((0)))))))") ;;; Printing with *print-level* (deftest print.cons.level.1 - (with-standard-io-syntax - (write-to-string '(a) - :case :downcase :level 0 - :readably nil :escape nil - :pretty nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(a) + :case :downcase :level 0 + :escape nil :pretty nil))) "#") (deftest print.cons.level.2 - (with-standard-io-syntax - (write-to-string '(a) - :case :downcase :level 1 - :readably nil :escape nil - :pretty nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(a) + :case :downcase :level 1 + :escape nil :pretty nil))) "(a)") (deftest print.cons.level.3 - (with-standard-io-syntax - (write-to-string '((a)) - :case :downcase :level 1 - :readably nil :escape nil - :pretty nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '((a)) + :case :downcase :level 1 + :escape nil :pretty nil))) "(#)") (deftest print.cons.level.4 - (with-standard-io-syntax - (write-to-string '(a) - :case :downcase :level 2 - :readably nil :escape nil - :pretty nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(a) + :case :downcase :level 2 + :escape nil :pretty nil))) "(a)") (deftest print.cons.level.5 - (with-standard-io-syntax - (write-to-string '(#(a) #*1101 "abc") - :case :downcase :level 1 - :readably nil :pretty nil)) + (my-with-standard-io-syntax + (let ((*print-readably* nil)) + (write-to-string '(#(a) #*1101 "abc") + :case :downcase :level 1 + :pretty nil))) "(# #*1101 \"abc\")") - diff --git a/ansi-tests/printer-aux.lsp b/ansi-tests/printer-aux.lsp index 6b947de537d301971dea0b2417fbcd0d5f43bcd7..8b7cc3742b9764ee860996bfa56372d44a033bdd 100644 --- a/ansi-tests/printer-aux.lsp +++ b/ansi-tests/printer-aux.lsp @@ -8,7 +8,7 @@ (defmacro def-print-test (name form result &rest bindings) `(deftest ,name (equalpt - (with-standard-io-syntax + (my-with-standard-io-syntax (let ((*print-readably* nil)) (let ,bindings (with-output-to-string (*standard-output*) (prin1 ,form))))) @@ -37,7 +37,7 @@ (debug *random-read-check-debug*)) (declare (type function test)) ;; Generate random printer-control values - (with-standard-io-syntax + (my-with-standard-io-syntax (let ((*print-array* (coin)) (*print-base* (+ 2 (random 34))) (*print-radix* (coin))