X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fprint.impure.lisp;h=ab25c65126b67bdc2b6f5d26821f53060c2f4370;hb=9d36021d86b7db7561b2edc40324c8e5229f88b3;hp=9d9fd6246e6943bb31fb937480a45d3af6d9c833;hpb=4c5a011ccc355e3653b9490de6a2b3df5777e55d;p=sbcl.git diff --git a/tests/print.impure.lisp b/tests/print.impure.lisp index 9d9fd62..ab25c65 100644 --- a/tests/print.impure.lisp +++ b/tests/print.impure.lisp @@ -276,7 +276,7 @@ ;;; a spot of random-testing for rational printing (defvar *seed-state* (make-random-state)) -(prin1 *seed-state*) ; so that we can reproduce errors +(print *seed-state*) ; so that we can reproduce errors (let ((seed (make-random-state *seed-state*))) (loop repeat 42 do (let ((n (random (ash 1 1000) seed)) @@ -298,5 +298,24 @@ (princ-to-string r))))))))) (write-char #\.) (finish-output))) + +;;;; Bugs, found by PFD +;;; NIL parameter for ~^ means `not supplied' +(loop for (format arg result) in + '(("~:{~D~v^~D~}" ((3 1 4) (1 0 2) (7 nil) (5 nil 6)) "341756") + ("~:{~1,2,v^~A~}" ((nil 0) (3 1) (0 2)) "02")) + do (assert (string= (funcall #'format nil format arg) result)) + do (assert (string= (with-output-to-string (s) + (funcall (eval `(formatter ,format)) s arg)) + result))) + +;;; NIL first parameter for ~R is equivalent to no parameter. +(assert (string= (format nil "~VR" nil 5) "five")) +(assert (string= (format nil (formatter "~VR") nil 6) "six")) + +;;; CSR inserted a bug into Burger & Dybvig's float printer. Caught +;;; by Raymond Toy +(assert (string= (format nil "~F" 1d23) "1.0d+23")) + ;;; success (quit :unix-status 104)