mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-09 14:07:34 +02:00
Adding reader label tests.
This commit is contained in:
parent
28f49d5252
commit
9b6c954891
1 changed files with 27 additions and 0 deletions
|
@ -1397,6 +1397,31 @@
|
|||
(write-u8 3 out)
|
||||
(get-output-bytevector out)))
|
||||
|
||||
(test "#0=(1 . #0#)" ;; not guaranteed to be 0 indexed, spacing may differ
|
||||
(let ((out (open-output-string))
|
||||
(x (list 1)))
|
||||
(set-cdr! x x)
|
||||
(write x out)
|
||||
(get-output-string out)))
|
||||
|
||||
(test "((1 2 3) (1 2 3))"
|
||||
(let ((out (open-output-string))
|
||||
(x (list 1 2 3)))
|
||||
(write (list x x) out)
|
||||
(get-output-string out)))
|
||||
|
||||
(test "((1 2 3) (1 2 3))"
|
||||
(let ((out (open-output-string))
|
||||
(x (list 1 2 3)))
|
||||
(write-simple (list x x) out)
|
||||
(get-output-string out)))
|
||||
|
||||
(test "(#0=(1 2 3) #0#)"
|
||||
(let ((out (open-output-string))
|
||||
(x (list 1 2 3)))
|
||||
(write-shared (list x x) out)
|
||||
(get-output-string out)))
|
||||
|
||||
;; read syntax
|
||||
|
||||
(test #t (read (open-input-string "#t")))
|
||||
|
@ -1409,6 +1434,8 @@
|
|||
(test '(1 . 2) (read (open-input-string "(1 . 2)")))
|
||||
(test '(1 2) (read (open-input-string "(1 . (2))")))
|
||||
(test '(1 2 3 4 5) (read (open-input-string "(1 . (2 3 4 . (5)))")))
|
||||
(test '1 (cadr (read (open-input-string "#0=(1 . #0#)"))))
|
||||
(test '(1 2 3) (cadr (read (open-input-string "(#0=(1 2 3) #0#)"))))
|
||||
|
||||
(test '(quote (1 2)) (read (open-input-string "'(1 2)")))
|
||||
(test '(quote (1 (unquote 2))) (read (open-input-string "'(1 ,2)")))
|
||||
|
|
Loading…
Add table
Reference in a new issue