+ do (setq *read-base* i)
+ do (assert (typep (read-from-string symbol-string) 'symbol)))))
+
+(let ((standard-chars " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
+")
+ (standard-terminating-macro-chars "\"'(),;`")
+ (standard-nonterminating-macro-chars "#"))
+ (flet ((frob (char)
+ (multiple-value-bind (fun non-terminating-p)
+ (get-macro-character char)
+ (cond
+ ((find char standard-terminating-macro-chars)
+ (unless (and fun (not non-terminating-p))
+ (list char)))
+ ((find char standard-nonterminating-macro-chars)
+ (unless (and fun non-terminating-p)
+ (list char)))
+ (t (unless (and (not fun) (not non-terminating-p))
+ (list char)))))))
+ (let ((*readtable* (copy-readtable nil)))
+ (assert (null (loop for c across standard-chars append (frob c)))))))
+
+(let ((standard-chars " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
+")
+ (undefined-chars "!\"$%&,;>?@[]^_`~{}/dDeEfFgGhHiIjJkKlLmMnNqQtTuUvVwWyYzZ"))
+ (flet ((frob (char)
+ (let ((fun (get-dispatch-macro-character #\# char)))
+ (cond
+ ((find char undefined-chars)
+ (when fun (list char)))
+ ((digit-char-p char 10)
+ (when fun (list char)))
+ (t
+ (unless fun (list char)))))))
+ (let ((*readtable* (copy-readtable nil)))
+ (assert (null (loop for c across standard-chars append (frob c)))))))
+
+;;; 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))))