X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fprint.impure.lisp;h=d1ccc0169e7b49cd0e78820b59d99d2e7d8f2008;hb=6b8baeece6cf870e3f979a9f09c32985c64c04de;hp=6d8072f0d91539a34a5f4fd89bdb11c36e4e974a;hpb=e15ca902a6c4eb6e4695e71400edbbd57c5e57cd;p=sbcl.git diff --git a/tests/print.impure.lisp b/tests/print.impure.lisp index 6d8072f..d1ccc01 100644 --- a/tests/print.impure.lisp +++ b/tests/print.impure.lisp @@ -416,4 +416,34 @@ ;;; This used to trigger an AVER instead. (assert (raises-error? (format t "~>") sb-format:format-error)) +;;; readably printing hash-tables, check for circularity +(let ((x (cons 1 2)) + (h (make-hash-table)) + (*print-readably* t) + (*print-circle* t) + (*read-eval* t)) + (setf (gethash x h) h) + (destructuring-bind (x2 . h2) (read-from-string (write-to-string (cons x h))) + (assert (equal x x2)) + (assert (eq h2 (gethash x2 h2))))) + +;;; an off-by-one error in the ~R format directive until 1.0.15.20 +;;; prevented printing cardinals and ordinals between (expt 10 63) and +;;; (1- (expt 10 66)) +(assert (string= (format nil "~R" (expt 10 63)) "one vigintillion")) +(assert (string= (format nil "~:R" (expt 10 63)) "one vigintillionth")) + +;;; too-clever cacheing for PRINT-OBJECT resulted in a bogus method +;;; for printing RESTART objects. Check also CONTROL-STACK-EXHAUSTED +;;; and HEAP-EXHAUSTED-ERROR. +(let ((result (with-output-to-string (*standard-output*) + (princ (find-restart 'abort))))) + (assert (string/= result "#<" :end1 2))) +(let ((result (with-output-to-string (*standard-output*) + (princ (make-condition 'sb-kernel::control-stack-exhausted))))) + (assert (string/= result "#<" :end1 2))) +(let ((result (with-output-to-string (*standard-output*) + (princ (make-condition 'sb-kernel::heap-exhausted-error))))) + (assert (string/= result "#<" :end1 2))) + ;;; success