unlock reader test

This commit is contained in:
Yuichi Nishiwaki 2014-06-28 20:02:06 +09:00
parent aae4bba98d
commit 8f5a4e8980
1 changed files with 45 additions and 45 deletions

View File

@ -32,7 +32,7 @@
; (scheme complex) ; (scheme complex)
(scheme time) (scheme time)
(scheme file) (scheme file)
; (scheme read) (scheme read)
(scheme write) (scheme write)
; (scheme eval) ; (scheme eval)
(scheme process-context) (scheme process-context)
@ -1962,56 +1962,56 @@
(test-begin "Read syntax") (test-begin "Read syntax")
;; check reading boolean followed by eof ;; check reading boolean followed by eof
;; (test #t (read (open-input-string "#t"))) (test #t (read (open-input-string "#t")))
;; (test #t (read (open-input-string "#true"))) (test #t (read (open-input-string "#true")))
;; (test #f (read (open-input-string "#f"))) (test #f (read (open-input-string "#f")))
;; (test #f (read (open-input-string "#false"))) (test #f (read (open-input-string "#false")))
;; (define (read2 port) (define (read2 port)
;; (let* ((o1 (read port)) (o2 (read port))) (let* ((o1 (read port)) (o2 (read port)))
;; (cons o1 o2))) (cons o1 o2)))
;; ;; check reading boolean followed by delimiter ;; check reading boolean followed by delimiter
;; (test '(#t . (5)) (read2 (open-input-string "#t(5)"))) (test '(#t . (5)) (read2 (open-input-string "#t(5)")))
;; (test '(#t . 6) (read2 (open-input-string "#true 6 "))) (test '(#t . 6) (read2 (open-input-string "#true 6 ")))
;; (test '(#f . 7) (read2 (open-input-string "#f 7"))) (test '(#f . 7) (read2 (open-input-string "#f 7")))
;; (test '(#f . "8") (read2 (open-input-string "#false\"8\""))) (test '(#f . "8") (read2 (open-input-string "#false\"8\"")))
;; (test '() (read (open-input-string "()"))) (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) (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 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 (cadr (read (open-input-string "#0=(1 . #0#)"))))
;; (test '(1 2 3) (cadr (read (open-input-string "(#0=(1 2 3) #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 2)) (read (open-input-string "'(1 2)")))
;; (test '(quote (1 (unquote 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 '(quote (1 (unquote-splicing 2))) (read (open-input-string "'(1 ,@2)")))
;; (test '(quasiquote (1 (unquote 2))) (read (open-input-string "`(1 ,2)"))) (test '(quasiquote (1 (unquote 2))) (read (open-input-string "`(1 ,2)")))
;; (test #() (read (open-input-string "#()"))) (test #() (read (open-input-string "#()")))
;; (test #(a b) (read (open-input-string "#(a b)"))) (test #(a b) (read (open-input-string "#(a b)")))
;; (test #u8() (read (open-input-string "#u8()"))) (test #u8() (read (open-input-string "#u8()")))
;; (test #u8(0 1) (read (open-input-string "#u8(0 1)"))) (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")))
;; (test 'abc (read (open-input-string "abc def"))) (test 'abc (read (open-input-string "abc def")))
;; (test 'ABC (read (open-input-string "ABC"))) (test 'ABC (read (open-input-string "ABC")))
;; (test 'Hello (read (open-input-string "|H\\x65;llo|"))) (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 ABC")))
;; (test 'ABC (read (open-input-string "#!fold-case #!no-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 def")))
;; (test 'def (read (open-input-string "; abc \ndef"))) (test 'def (read (open-input-string "; abc \ndef")))
;; (test 'def (read (open-input-string "#| abc |# def"))) (test 'def (read (open-input-string "#| abc |# def")))
;; (test 'ghi (read (open-input-string "#| abc #| def |# |# ghi"))) (test 'ghi (read (open-input-string "#| abc #| def |# |# ghi")))
;; (test 'ghi (read (open-input-string "#; ; abc\n def ghi"))) (test 'ghi (read (open-input-string "#; ; abc\n def ghi")))
;; (test '(abs -16) (read (open-input-string "(#;sqrt abs -16)"))) (test '(abs -16) (read (open-input-string "(#;sqrt abs -16)")))
;; (test '(a d) (read (open-input-string "(a #; #;b c d)"))) (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 e) (read (open-input-string "(a #;(b #;c d) e)")))
;; (test '(a . c) (read (open-input-string "(a . #;b c)"))) (test '(a . c) (read (open-input-string "(a . #;b c)")))
;; (test '(a . b) (read (open-input-string "(a . b #;c)"))) (test '(a . b) (read (open-input-string "(a . b #;c)")))
;; (define (test-read-error str) ;; (define (test-read-error str)
;; (test-assert ;; (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 "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 #x03BB (char->integer (string-ref (read (open-input-string "\"\\x03BB;\"")) 0)))
;; (test-end) (test-end)
(test-begin "Numeric syntax") (test-begin "Numeric syntax")