summaryrefslogtreecommitdiff
path: root/test-suite/tests/reader.test
diff options
context:
space:
mode:
Diffstat (limited to 'test-suite/tests/reader.test')
-rw-r--r--test-suite/tests/reader.test35
1 files changed, 35 insertions, 0 deletions
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index 0b6f9a468..bd34e4db0 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)
@@ -194,3 +196,36 @@
(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)))
+
+(with-test-prefix "#'"
+ (for-each
+ (lambda (pair)
+ (pass-if (car pair)
+ (equal? (with-input-from-string (car pair) read) (cdr pair))))
+
+ '(("#'foo". (syntax foo))
+ ("#`foo" . (quasisyntax foo))
+ ("#,foo" . (unsyntax foo))
+ ("#,@foo" . (unsyntax-splicing foo)))))
+
+