From 8f5a4e8980b3ce32a8ca0efb26a66495b05caeb8 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sat, 28 Jun 2014 20:02:06 +0900 Subject: [PATCH] unlock reader test --- t/r7rs-tests.scm | 90 ++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/t/r7rs-tests.scm b/t/r7rs-tests.scm index e5ce8af7..5836ed26 100644 --- a/t/r7rs-tests.scm +++ b/t/r7rs-tests.scm @@ -32,7 +32,7 @@ ; (scheme complex) (scheme time) (scheme file) -; (scheme read) + (scheme read) (scheme write) ; (scheme eval) (scheme process-context) @@ -1962,56 +1962,56 @@ (test-begin "Read syntax") ;; check reading boolean followed by eof -;; (test #t (read (open-input-string "#t"))) -;; (test #t (read (open-input-string "#true"))) -;; (test #f (read (open-input-string "#f"))) -;; (test #f (read (open-input-string "#false"))) -;; (define (read2 port) -;; (let* ((o1 (read port)) (o2 (read port))) -;; (cons o1 o2))) -;; ;; check reading boolean followed by delimiter -;; (test '(#t . (5)) (read2 (open-input-string "#t(5)"))) -;; (test '(#t . 6) (read2 (open-input-string "#true 6 "))) -;; (test '(#f . 7) (read2 (open-input-string "#f 7"))) -;; (test '(#f . "8") (read2 (open-input-string "#false\"8\""))) +(test #t (read (open-input-string "#t"))) +(test #t (read (open-input-string "#true"))) +(test #f (read (open-input-string "#f"))) +(test #f (read (open-input-string "#false"))) +(define (read2 port) + (let* ((o1 (read port)) (o2 (read port))) + (cons o1 o2))) +;; check reading boolean followed by delimiter +(test '(#t . (5)) (read2 (open-input-string "#t(5)"))) +(test '(#t . 6) (read2 (open-input-string "#true 6 "))) +(test '(#f . 7) (read2 (open-input-string "#f 7"))) +(test '(#f . "8") (read2 (open-input-string "#false\"8\""))) -;; (test '() (read (open-input-string "()"))) -;; (test '(1 2) (read (open-input-string "(1 2)"))) -;; (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 '() (read (open-input-string "()"))) +(test '(1 2) (read (open-input-string "(1 2)"))) +(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)"))) -;; (test '(quote (1 (unquote-splicing 2))) (read (open-input-string "'(1 ,@2)"))) -;; (test '(quasiquote (1 (unquote 2))) (read (open-input-string "`(1 ,2)"))) +(test '(quote (1 2)) (read (open-input-string "'(1 2)"))) +(test '(quote (1 (unquote 2))) (read (open-input-string "'(1 ,2)"))) +(test '(quote (1 (unquote-splicing 2))) (read (open-input-string "'(1 ,@2)"))) +(test '(quasiquote (1 (unquote 2))) (read (open-input-string "`(1 ,2)"))) -;; (test #() (read (open-input-string "#()"))) -;; (test #(a b) (read (open-input-string "#(a b)"))) +(test #() (read (open-input-string "#()"))) +(test #(a b) (read (open-input-string "#(a b)"))) -;; (test #u8() (read (open-input-string "#u8()"))) -;; (test #u8(0 1) (read (open-input-string "#u8(0 1)"))) +(test #u8() (read (open-input-string "#u8()"))) +(test #u8(0 1) (read (open-input-string "#u8(0 1)"))) -;; (test 'abc (read (open-input-string "abc"))) -;; (test 'abc (read (open-input-string "abc def"))) -;; (test 'ABC (read (open-input-string "ABC"))) -;; (test 'Hello (read (open-input-string "|H\\x65;llo|"))) +(test 'abc (read (open-input-string "abc"))) +(test 'abc (read (open-input-string "abc def"))) +(test 'ABC (read (open-input-string "ABC"))) +(test 'Hello (read (open-input-string "|H\\x65;llo|"))) -;; (test 'abc (read (open-input-string "#!fold-case ABC"))) -;; (test 'ABC (read (open-input-string "#!fold-case #!no-fold-case ABC"))) +(test 'abc (read (open-input-string "#!fold-case ABC"))) +(test 'ABC (read (open-input-string "#!fold-case #!no-fold-case ABC"))) -;; (test 'def (read (open-input-string "#; abc def"))) -;; (test 'def (read (open-input-string "; abc \ndef"))) -;; (test 'def (read (open-input-string "#| abc |# def"))) -;; (test 'ghi (read (open-input-string "#| abc #| def |# |# ghi"))) -;; (test 'ghi (read (open-input-string "#; ; abc\n def ghi"))) -;; (test '(abs -16) (read (open-input-string "(#;sqrt abs -16)"))) -;; (test '(a d) (read (open-input-string "(a #; #;b c d)"))) -;; (test '(a e) (read (open-input-string "(a #;(b #;c d) e)"))) -;; (test '(a . c) (read (open-input-string "(a . #;b c)"))) -;; (test '(a . b) (read (open-input-string "(a . b #;c)"))) +(test 'def (read (open-input-string "#; abc def"))) +(test 'def (read (open-input-string "; abc \ndef"))) +(test 'def (read (open-input-string "#| abc |# def"))) +(test 'ghi (read (open-input-string "#| abc #| def |# |# ghi"))) +(test 'ghi (read (open-input-string "#; ; abc\n def ghi"))) +(test '(abs -16) (read (open-input-string "(#;sqrt abs -16)"))) +(test '(a d) (read (open-input-string "(a #; #;b c d)"))) +(test '(a e) (read (open-input-string "(a #;(b #;c d) e)"))) +(test '(a . c) (read (open-input-string "(a . #;b c)"))) +(test '(a . b) (read (open-input-string "(a . b #;c)"))) ;; (define (test-read-error str) ;; (test-assert @@ -2058,7 +2058,7 @@ ;; (test "line 1\n\nline 3\n" (read (open-input-string "\"line 1\\ \t \n \t \n\nline 3\n\""))) ;; (test #x03BB (char->integer (string-ref (read (open-input-string "\"\\x03BB;\"")) 0))) -;; (test-end) +(test-end) (test-begin "Numeric syntax")