From aeb01091596262b64db78f1ca556674ab77d38b6 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sun, 11 Nov 2012 14:14:05 +0900 Subject: [PATCH] Adding additional tests for char names and string escapes. --- tests/r7rs-tests.scm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/r7rs-tests.scm b/tests/r7rs-tests.scm index 9f0a12f5..3904c43e 100644 --- a/tests/r7rs-tests.scm +++ b/tests/r7rs-tests.scm @@ -1432,18 +1432,35 @@ (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 #\a (read (open-input-string "#\\a"))) (test #\space (read (open-input-string "#\\space"))) -(test #\alarm (read (open-input-string "#\\alarm"))) -(test #\λ (read (open-input-string "#\\x03BB"))) +(test 0 (char->integer (read (open-input-string "#\\null")))) +(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\" \"def\""))) (test "ABC" (read (open-input-string "\"ABC\""))) (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 #x03BB (char->integer (string-ref (read (open-input-string "\"\\x03BB;\"")) 0))) ;; Numeric syntax adapted from Peter Bex's tests. ;;