X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Freader.pure.lisp;h=f0644572ca0d82ec41f80ca48ace11f35e07912f;hb=1b650be8b800cf96e2c268ae317fb26d0bf36827;hp=728722a1064a9afff2bd323fab681bdb7d52cad7;hpb=64cebbaaccfc9ba3bbcc2d4136fbab5791442823;p=sbcl.git diff --git a/tests/reader.pure.lisp b/tests/reader.pure.lisp index 728722a..f064457 100644 --- a/tests/reader.pure.lisp +++ b/tests/reader.pure.lisp @@ -59,3 +59,35 @@ (let ((*readtable* (copy-readtable))) (set-syntax-from-char #\7 #\;) (assert (= 1235 (read-from-string "123579")))) + +;;; PARSE-INTEGER must signal an error of type PARSE-ERROR if it is +;;; unable to parse an integer and :JUNK-ALLOWED is NIL. +(macrolet ((assert-parse-error (form) + `(multiple-value-bind (val cond) + (ignore-errors ,form) + (assert (null val)) + (assert (typep cond 'parse-error))))) + (assert-parse-error (parse-integer " ")) + (assert-parse-error (parse-integer "12 a")) + (assert-parse-error (parse-integer "12a")) + (assert-parse-error (parse-integer "a")) + (assert (= (parse-integer "12") 12)) + (assert (= (parse-integer " 12 ") 12)) + (assert (= (parse-integer " 12asdb" :junk-allowed t) 12))) + +;;; #A notation enforces that once one 0 dimension has been found, all +;;; subsequent ones are also 0. +(assert (equal (array-dimensions (read-from-string "#3A()")) + '(0 0 0))) +(assert (equal (array-dimensions (read-from-string "#3A(())")) + '(1 0 0))) +(assert (equal (array-dimensions (read-from-string "#3A((() ()))")) + '(1 2 0))) + +;;; Bug reported by Nikodemus Siivola on sbcl-devel 2003-07-21: +;;; package misconfiguration +(assert (eq + (handler-case (with-input-from-string (s "cl:") (read s)) + (end-of-file (c) + 'good)) + 'good)) \ No newline at end of file