1 ;;;; reader.test --- test the Guile parser -*- scheme -*-
2 ;;;; Jim Blandy <jimb@red-bean.com> --- September 1999
5 (cons 'misc-error "^end of file"))
6 (define exception:unexpected-rparen
7 (cons 'misc-error "^unexpected \")\""))
9 (define (read-string s)
10 (with-input-from-string s (lambda () (read))))
12 (with-test-prefix "reading"
14 (equal? (read-string "0") 0))
16 (equal? (read-string "1++i") '1++i))
18 (equal? (read-string "1+i+i") '1+i+i))
20 (equal? (read-string "1+e10000i") '1+e10000i)))
22 (pass-if-exception "radix passed to number->string can't be zero"
23 exception:out-of-range
24 (number->string 10 0))
25 (pass-if-exception "radix passed to number->string can't be one either"
26 exception:out-of-range
27 (number->string 10 1))
29 (with-test-prefix "mismatching parentheses"
30 (pass-if-exception "opening parenthesis"
33 (pass-if-exception "closing parenthesis following mismatched opening"
34 exception:unexpected-rparen
36 (pass-if-exception "opening vector parenthesis"
39 (pass-if-exception "closing parenthesis following mismatched vector opening"
40 exception:unexpected-rparen