From: Lutz Euler Date: Sat, 9 Jun 2012 19:24:21 +0000 (+0200) Subject: Add tests for two bugs that were incidentally fixed some time ago. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=d4b41d5e69c921361e0978e5d4a7519ae54b9c6a;p=sbcl.git Add tests for two bugs that were incidentally fixed some time ago. Commit b894cb41d869bda6ba0c54a491becc7bb58375c1 (make FORMAT signal errors with illegal COLINC etc. parameters) happened to fix bug 905817 (endless loop in FORMAT with zero COLINC), then unnoticed, so add a regression test and NEWS now. Commit 96c62c30ec9164419c790b2fbea953da2193620f (ensure that GCD returns positive values) besides the one intended also fixed bug 516750 (type error when trying to convert a sum of rationals to a float). Add the failing expression from that bug to the existing test. --- diff --git a/NEWS b/NEWS index 43a87e6..2e0dba0 100644 --- a/NEWS +++ b/NEWS @@ -40,6 +40,9 @@ changes relative to sbcl-1.0.57: * bug fix: compiler-macro lambda-lists specifying non-keyword symbols as keyword arguments no longer accidentally match unevaluated symbols against them. + * bug fix: FORMAT used to loop infinitely in some cases when a COLINC + parameter was zero, now it signals an error. (lp#905817, fixed since + 1.0.56.19) changes in sbcl-1.0.57 relative to sbcl-1.0.56: * RANDOM enhancements and bug fixes: diff --git a/tests/arith.pure.lisp b/tests/arith.pure.lisp index 77291ff..777b370 100644 --- a/tests/arith.pure.lisp +++ b/tests/arith.pure.lisp @@ -371,8 +371,12 @@ ;; GCD used to sometimes return negative values. The following did, on 32 bit ;; builds. (with-test (:name :gcd) + ;; from lp#413680 (assert (plusp (gcd 20286123923750474264166990598656 - 680564733841876926926749214863536422912)))) + 680564733841876926926749214863536422912))) + ;; from lp#516750 + (assert (plusp (gcd 2596102012663483082521318626691873 + 2596148429267413814265248164610048)))) (with-test (:name :expt-zero-zero) ;; Check that (expt 0.0 0.0) and (expt 0 0.0) signal error, but (expt 0.0 0) diff --git a/tests/print.impure.lisp b/tests/print.impure.lisp index 5ab865c..46a06a6 100644 --- a/tests/print.impure.lisp +++ b/tests/print.impure.lisp @@ -635,4 +635,13 @@ (assert (raises-error? (format nil "~-2a" 1))) (assert (raises-error? (format nil "~,0a" 1)))) +(with-test (:name :bug-905817) + ;; The bug manifests itself in an endless loop in FORMAT. + ;; Correct behaviour is to signal an error. + (handler-case + (with-timeout 5 + (assert (raises-error? (format nil "e~8,0s" 12395)))) + (timeout () + (error "Endless loop in FORMAT")))) + ;;; success