mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 22:31:12 +02:00
add reader tests for #;
* test-suite/tests/reader.test ("#;"): Add reader tests for #;.
This commit is contained in:
parent
34f3d47df9
commit
6ed0c41a2d
1 changed files with 23 additions and 0 deletions
|
@ -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)))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue