X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fprint.impure.lisp;h=4f1b3f54431a4df7ffae81b038cb5b1d6c58df10;hb=9b1fade83db8453b75b8c7380eb12ce41b5b889c;hp=5aca94fc65f67896a72c79a87343815f7711bf49;hpb=8f41e246101ca3906d6c77da51c9de5601777b28;p=sbcl.git diff --git a/tests/print.impure.lisp b/tests/print.impure.lisp index 5aca94f..4f1b3f5 100644 --- a/tests/print.impure.lisp +++ b/tests/print.impure.lisp @@ -410,4 +410,27 @@ (with-test (:name (:print-readable :character :iso-8859-1)) (test-readable-character (code-char #xfffe) :iso-8859-1)) +(assert (string= (eval '(format nil "~:C" #\a)) "a")) +(assert (string= (format nil (formatter "~:C") #\a) "a")) + +;;; 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")) + ;;; success