summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-05-28 14:59:47 +0200
committerAndy Wingo <wingo@pobox.com>2009-05-28 14:59:47 +0200
commit6ed0c41a2d621c485a0b0e1b39535fd5a1e9bd20 (patch)
tree7164db5966077d90a479416a6d56979ef340ba7d
parent34f3d47df9311852ba7eab6f8d1c36535c3774dd (diff)
downloadguile-6ed0c41a2d621c485a0b0e1b39535fd5a1e9bd20.tar.gz
add reader tests for #;
* test-suite/tests/reader.test ("#;"): Add reader tests for #;.
-rw-r--r--test-suite/tests/reader.test23
1 files changed, 23 insertions, 0 deletions
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index b068c716d..bd9ba2155 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -35,6 +35,8 @@
(cons 'read-error "end of file in string constant$"))
(define exception:illegal-escape
(cons 'read-error "illegal character in escape sequence: .*$"))
+(define exception:missing-expression
+ (cons 'read-error "no expression after #;"))
(define (read-string s)
@@ -189,3 +191,24 @@
(and (equal? (source-property sexp 'line) 0)
(equal? (source-property sexp 'column) 0)))))
+(with-test-prefix "#;"
+ (for-each
+ (lambda (pair)
+ (pass-if (car pair)
+ (equal? (with-input-from-string (car pair) read) (cdr pair))))
+
+ '(("#;foo 10". 10)
+ ("#;(10 20 30) foo" . foo)
+ ("#; (10 20 30) foo" . foo)
+ ("#;\n10\n20" . 20)))
+
+ (pass-if "#;foo"
+ (eof-object? (with-input-from-string "#;foo" read)))
+
+ (pass-if-exception "#;"
+ exception:missing-expression
+ (with-input-from-string "#;" read))
+ (pass-if-exception "#;("
+ exception:eof
+ (with-input-from-string "#;(" read)))
+