X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Freader.impure.lisp;h=214ca6f96d53516552266bdb917287866128516f;hb=b3a419f10ad442a1c59d51edabdc70518f193648;hp=84be1cf6979a806ecdb3c4ce6f56740952cb56c0;hpb=0957d59ccfaf3db9aaf79a7f4909a40ea0ca0dcd;p=sbcl.git diff --git a/tests/reader.impure.lisp b/tests/reader.impure.lisp index 84be1cf..214ca6f 100644 --- a/tests/reader.impure.lisp +++ b/tests/reader.impure.lisp @@ -41,5 +41,23 @@ (assert (raises-error? (read-from-string "1e1000") reader-error)) (assert (raises-error? (read-from-string "1/0") reader-error)) +;;; Bug reported by Antonio Martinez on comp.lang.lisp 2003-02-03 in +;;; message : reading +;;; circular instances of CLOS classes didn't work: +(defclass box () + ((value :initarg :value :reader value))) +(defun read-box (stream char) + (declare (ignore char)) + (let ((objects (read-delimited-list #\] stream t))) + (unless (= 1 (length objects)) + (error "Unknown box reader syntax")) + (make-instance 'box :value (first objects)))) +(set-macro-character #\[ 'read-box) +(set-syntax-from-char #\] #\)) +(multiple-value-bind (res pos) + (read-from-string "#1=[#1#]") + (assert (eq (value res) res)) + (assert (= pos 8))) + ;;; success (quit :unix-status 104)