0.6.11.35:
[sbcl.git] / tests / print.impure.lisp
1 (in-package :cl-user)
2
3 ;;; We should be able to output X readably (at least when *READ-EVAL*).
4 (defun assert-readable-output (x)
5   (assert (eql x
6                (let ((*read-eval* t))
7                  (read-from-string (with-output-to-string (s)
8                                      (write x :stream s :readably t)))))))
9
10 ;;; Even when *READ-EVAL* is NIL, we should be able to output some
11 ;;; (not necessarily readable) representation without signalling an
12 ;;; error.
13 (defun assert-unreadable-output (x)
14   (let ((*read-eval* nil))
15     (with-output-to-string (s) (write x :stream s :readably nil))))
16   
17 (defun assert-output (x)
18   (assert-readable-output x)
19   (assert-unreadable-output x))
20
21 ;;; Nathan Froyd reported that sbcl-0.6.11.34 screwed up output of
22 ;;; floating point infinities.
23 (dolist (x (list short-float-positive-infinity short-float-negative-infinity
24                  single-float-positive-infinity single-float-negative-infinity
25                  double-float-positive-infinity double-float-negative-infinity
26                  long-float-positive-infinity long-float-negative-infinity))
27   (assert-output x))
28  
29 ;;; success
30 (quit :unix-status 104)