X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Freader.pure.lisp;h=7eddc5d9f91c980716a5237398cdb37a6bdc82fd;hb=40bf78b47ea89b15698adb9c550efa4cbacafeb7;hp=9a4307482015e7db5e991acea7fea1712f8e4817;hpb=cc676f35baa0a46df06d9917e087ca466d053027;p=sbcl.git diff --git a/tests/reader.pure.lisp b/tests/reader.pure.lisp index 9a43074..7eddc5d 100644 --- a/tests/reader.pure.lisp +++ b/tests/reader.pure.lisp @@ -51,3 +51,35 @@ ;; so it'd be more logical for NON-TERMINATING-P to be T in ;; this case; but ANSI says it's NIL in this case. (assert (null non-terminating-p)))) + +;;; rudimentary test of SET-SYNTAX-FROM-CHAR, just to verify that it +;;; wasn't totally broken by the GET-MACRO-CHARACTER/SET-MACRO-CHARACTER +;;; fixes in 0.7.3.16 +(assert (= 123579 (read-from-string "123579"))) +(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)))