mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-15 10:10:21 +02:00
25 lines
702 B
Scheme
25 lines
702 B
Scheme
;;;; reader.test --- test the Guile parser -*- scheme -*-
|
|
;;;; Jim Blandy <jimb@red-bean.com> --- September 1999
|
|
|
|
(define (try-to-read string)
|
|
(pass-if (call-with-output-string (lambda (port)
|
|
(display "Try to read " port)
|
|
(write string port)))
|
|
(not (signals-error?
|
|
'signal
|
|
(call-with-input-string string
|
|
(lambda (p) (read p)))))))
|
|
|
|
(try-to-read "0")
|
|
(try-to-read "1++i")
|
|
(try-to-read "1+i+i")
|
|
(try-to-read "1+e10000i")
|
|
|
|
(pass-if "radix passed to number->string can't be zero"
|
|
(signals-error?
|
|
'out-of-range
|
|
(number->string 10 0)))
|
|
(pass-if "radix passed to number->string can't be one either"
|
|
(signals-error?
|
|
'out-of-range
|
|
(number->string 10 1)))
|