+
+;;; All these must return a primary value of NIL when *read-suppress* is T
+;;; Reported by Bruno Haible on cmucl-imp 2004-10-25.
+(let ((*read-suppress* t))
+ (assert (null (read-from-string "(1 2 3)")))
+ (assert (null (with-input-from-string (s "abc xyz)")
+ (read-delimited-list #\) s))))
+ (assert (null (with-input-from-string (s "(1 2 3)")
+ (read-preserving-whitespace s))))
+ (assert (null (with-input-from-string (s "(1 2 3)")
+ (read s)))))
+
+;;; EOF-ERROR-P defaults to true. Reported by Bruno Haible on
+;;; cmucl-imp 2004-10-18.
+(multiple-value-bind (res err) (ignore-errors (read-from-string ""))
+ (assert (not res))
+ (assert (typep err 'end-of-file)))
+
+(assert (equal '((0 . "A") (1 . "B"))
+ (coerce (read-from-string "#((0 . \"A\") (1 . \"B\"))")
+ 'list)))
+
+;;; parse-integer uses whitespace[1] not whitespace[2] as its
+;;; definition of whitespace to skip.
+(let ((*readtable* (copy-readtable)))
+ (set-syntax-from-char #\7 #\Space)
+ (assert (= 710 (parse-integer "710"))))
+
+(let ((*readtable* (copy-readtable)))
+ (set-syntax-from-char #\7 #\Space)
+ (assert (string= (format nil "~7D" 1) " 1")))
+
+(let ((symbol (find-symbol "DOES-NOT-EXIST" "CL-USER")))
+ (assert (null symbol))
+ (handler-case
+ (read-from-string "CL-USER:DOES-NOT-EXIST")
+ (reader-error (c)
+ (princ c))))
+
+;;; The GET-MACRO-CHARACTER in SBCL <= "1.0.34.2" bogusly computed its
+;;; second return value relative to *READTABLE* rather than the passed
+;;; readtable.
+(let* ((*readtable* (copy-readtable nil)))
+ (set-syntax-from-char #\" #\A)
+ (multiple-value-bind (reader-fn non-terminating-p)
+ (get-macro-character #\" (copy-readtable nil))
+ (declare (ignore reader-fn))
+ (assert (not non-terminating-p))))
+
+(with-test (:name :bug-309093)
+ (assert (eq :error
+ (handler-case
+ (read-from-string "`#2A((,(1+ 0) 0) (0 0))")
+ (reader-error ()
+ :error)))))
+
+(with-test (:name :set-syntax-from-char-dispatch-macro-char)
+ (let ((rt (copy-readtable)))
+ (make-dispatch-macro-character #\! nil rt)
+ (set-dispatch-macro-character #\! #\! (constantly 'bang^2) rt)
+ (flet ((maybe-bang ()
+ (let ((*readtable* rt))
+ (read-from-string "!!"))))
+ (assert (eq 'bang^2 (maybe-bang)))
+ (set-syntax-from-char #\! #\! rt)
+ (assert (eq '!! (maybe-bang))))))
+
+(with-test (:name :read-in-package-syntax)
+ (assert (equal '(sb-c::a (sb-kernel::x sb-kernel::y) sb-c::b)
+ (read-from-string "sb-c::(a sb-kernel::(x y) b)")))
+ #+sb-package-locks
+ (assert (eq :violated!
+ (handler-case
+ (read-from-string "cl::'foo")
+ (package-lock-violation ()
+ :violated!)))))
+
+(with-test (:name :bug-309070)
+ (with-timeout 10
+ (assert (raises-error? (read-from-string "10e10000000000000000000")
+ sb-kernel:reader-impossible-number-error))))
+
+(with-test (:name :bug-1095918)
+ (assert (= (length `#3(1)) 3)))