Adding additional tests for char names and string escapes.

This commit is contained in:
Alex Shinn 2012-11-11 14:14:05 +09:00
parent 4ffcba797c
commit aeb0109159

View file

@ -1432,18 +1432,35 @@
(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\n def ghi"))) (test 'ghi (read (open-input-string "#; ; abc\n def ghi")))
(test #\a (read (open-input-string "#\\a"))) (test #\a (read (open-input-string "#\\a")))
(test #\space (read (open-input-string "#\\space"))) (test #\space (read (open-input-string "#\\space")))
(test #\alarm (read (open-input-string "#\\alarm"))) (test 0 (char->integer (read (open-input-string "#\\null"))))
(test #\λ (read (open-input-string "#\\x03BB"))) (test 7 (char->integer (read (open-input-string "#\\alarm"))))
(test 8 (char->integer (read (open-input-string "#\\backspace"))))
(test 9 (char->integer (read (open-input-string "#\\tab"))))
(test 10 (char->integer (read (open-input-string "#\\newline"))))
(test 13 (char->integer (read (open-input-string "#\\return"))))
(test #x7F (char->integer (read (open-input-string "#\\delete"))))
(test #x1B (char->integer (read (open-input-string "#\\escape"))))
(test #x03BB (char->integer (read (open-input-string "#\\λ"))))
(test #x03BB (char->integer (read (open-input-string "#\\x03BB"))))
(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 7 (char->integer (string-ref (read (open-input-string "\"\\a\"")) 0)))
(test 8 (char->integer (string-ref (read (open-input-string "\"\\b\"")) 0)))
(test 9 (char->integer (string-ref (read (open-input-string "\"\\t\"")) 0)))
(test 10 (char->integer (string-ref (read (open-input-string "\"\\n\"")) 0)))
(test 13 (char->integer (string-ref (read (open-input-string "\"\\r\"")) 0)))
(test #x22 (char->integer (string-ref (read (open-input-string "\"\\\"\"")) 0)))
(test #x7C (char->integer (string-ref (read (open-input-string "\"\\|\"")) 0)))
(test "line 1\nline 2\n" (read (open-input-string "\"line 1\nline 2\n\""))) (test "line 1\nline 2\n" (read (open-input-string "\"line 1\nline 2\n\"")))
(test #x03BB (char->integer (string-ref (read (open-input-string "\"\\x03BB;\"")) 0)))
;; Numeric syntax adapted from Peter Bex's tests. ;; Numeric syntax adapted from Peter Bex's tests.
;; ;;