X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fread.lisp;h=a7cfa940763896aa86a05dca3b2fcf07936b72f4;hb=e2040ea9a5d5794b68a34277d459d52b475d6eff;hp=fa841a2f31f31e4265e508e1ebb0cf8146cd0a5d;hpb=cca4e153dd07ff78d4d9b9bb764bb9ff080c5ca5;p=jscl.git diff --git a/tests/read.lisp b/tests/read.lisp index fa841a2..a7cfa94 100644 --- a/tests/read.lisp +++ b/tests/read.lisp @@ -12,3 +12,33 @@ (test (equal (read-from-string "(1 .25)") '(1 0.25))) (test (equal (read-from-string ".25") 0.25)) (test (equal (read-from-string "(1 . 25)") '(1 . 25))) + +(test (equal (read-from-string "(#1=99 2 3 #1#)") '(99 2 3 99))) +(let ((v (read-from-string "#(#1=99 2 3 #1#)"))) + (test (and (eql (aref v 0) 99) + (eql (aref v 1) 2) + (eql (aref v 2) 3) + (eql (aref v 3) 99)))) + +(test (let ((x (read-from-string "#1=(42 . #1#)"))) + (and (eql (nth 99 x) 42) + (progn + (rplaca x 13) + (eql (nth 99 x) 13)) + (eq x (cdr x))))) + +(test (let ((x (read-from-string "#1=#(1 #2=99 #1# #2#)"))) + (and (eql (aref x 0) 1) + (eql (aref x 1) 99) + (eq (aref x 2) x) + (eql (aref x 3) 99)))) + +(test (let ((x (read-from-string "#1=(1 2 #2=#(3 4 #1#) 5 #2#)"))) + (and (eql (nth 0 x) 1) + (eql (nth 1 x) 2) + (eql (aref (nth 2 x) 0) 3) + (eql (aref (nth 2 x) 1) 4) + (eq (aref (nth 2 x) 2) x) + (eql (nth 3 x) 5) + (eq (nth 4 x) (nth 2 x))))) +