* Provide and use new convenience macros to test for exceptions.
[bpt/guile.git] / test-suite / tests / reader.test
1 ;;;; reader.test --- test the Guile parser -*- scheme -*-
2 ;;;; Jim Blandy <jimb@red-bean.com> --- September 1999
3
4 (define (read-string s)
5 (with-input-from-string s (lambda () (read))))
6
7 (with-test-prefix "reading"
8 (pass-if "0"
9 (equal? (read-string "0") 0))
10 (pass-if "1++i"
11 (equal? (read-string "1++i") '1++i))
12 (pass-if "1+i+i"
13 (equal? (read-string "1+i+i") '1+i+i))
14 (pass-if "1+e10000i"
15 (equal? (read-string "1+e10000i") '1+e10000i)))
16
17 (pass-if-exception "radix passed to number->string can't be zero"
18 exception:out-of-range
19 (number->string 10 0))
20 (pass-if-exception "radix passed to number->string can't be one either"
21 exception:out-of-range
22 (number->string 10 1))