mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
* Moved reader related tests from exceptions.test to reader.test.
This commit is contained in:
parent
88f9ab70d0
commit
ef9709dacc
3 changed files with 30 additions and 12 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2001-02-28 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||||
|
|
||||||
|
* reader.test, exceptions.test: Moved the reader related test
|
||||||
|
cases from exceptions.test to reader.test.
|
||||||
|
|
||||||
|
* reader.test (exception:eof, exception:unexpected-rparen): New
|
||||||
|
constants.
|
||||||
|
|
||||||
|
* exceptions.test (read-string, x:eof, x:unexpected-rparen):
|
||||||
|
Removed.
|
||||||
|
|
||||||
2001-02-28 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
2001-02-28 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||||
|
|
||||||
* lib.scm (signals-error?, signals-error?*): Removed.
|
* lib.scm (signals-error?, signals-error?*): Removed.
|
||||||
|
|
|
@ -60,9 +60,6 @@
|
||||||
|
|
||||||
(use-modules (test-suite lib) (ice-9 regex) (ice-9 common-list))
|
(use-modules (test-suite lib) (ice-9 regex) (ice-9 common-list))
|
||||||
|
|
||||||
(define (read-string s)
|
|
||||||
(with-input-from-string s (lambda () (read))))
|
|
||||||
|
|
||||||
(defmacro expect-exception (name-snippet expression)
|
(defmacro expect-exception (name-snippet expression)
|
||||||
`(pass-if (with-output-to-string
|
`(pass-if (with-output-to-string
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
@ -97,8 +94,6 @@
|
||||||
(define x:missing/extra-expr "[Mm]issing or extra expression")
|
(define x:missing/extra-expr "[Mm]issing or extra expression")
|
||||||
(define x:wrong-num-args "[Ww]rong number of arguments")
|
(define x:wrong-num-args "[Ww]rong number of arguments")
|
||||||
(define x:wrong-type-arg "[Ww]rong type argument")
|
(define x:wrong-type-arg "[Ww]rong type argument")
|
||||||
(define x:eof "[Ee]nd of file")
|
|
||||||
(define x:unexpected-rparen "[Uu]nexpected \")\"")
|
|
||||||
|
|
||||||
;; This is to encourage people to write tests.
|
;; This is to encourage people to write tests.
|
||||||
|
|
||||||
|
@ -116,13 +111,6 @@
|
||||||
;; Tests
|
;; Tests
|
||||||
|
|
||||||
(with-test-prefix "syntax"
|
(with-test-prefix "syntax"
|
||||||
(with-test-prefix "reading"
|
|
||||||
(goad x:eof (read-string "("))
|
|
||||||
(goad x:unexpected-rparen (read-string ")"))
|
|
||||||
(goad x:eof (read-string "#("))
|
|
||||||
(goad x:unexpected-rparen (read-string ")"))
|
|
||||||
;; Add more (syntax reading) exceptions here.
|
|
||||||
)
|
|
||||||
(with-test-prefix "lambda"
|
(with-test-prefix "lambda"
|
||||||
|
|
||||||
(goad x:bad-formals (lambda (x 1) 2))
|
(goad x:bad-formals (lambda (x 1) 2))
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
;;;; reader.test --- test the Guile parser -*- scheme -*-
|
;;;; reader.test --- test the Guile parser -*- scheme -*-
|
||||||
;;;; Jim Blandy <jimb@red-bean.com> --- September 1999
|
;;;; Jim Blandy <jimb@red-bean.com> --- September 1999
|
||||||
|
|
||||||
|
(define exception:eof
|
||||||
|
(cons 'misc-error "^end of file"))
|
||||||
|
(define exception:unexpected-rparen
|
||||||
|
(cons 'misc-error "^unexpected \")\""))
|
||||||
|
|
||||||
(define (read-string s)
|
(define (read-string s)
|
||||||
(with-input-from-string s (lambda () (read))))
|
(with-input-from-string s (lambda () (read))))
|
||||||
|
|
||||||
|
@ -20,3 +25,17 @@
|
||||||
(pass-if-exception "radix passed to number->string can't be one either"
|
(pass-if-exception "radix passed to number->string can't be one either"
|
||||||
exception:out-of-range
|
exception:out-of-range
|
||||||
(number->string 10 1))
|
(number->string 10 1))
|
||||||
|
|
||||||
|
(with-test-prefix "mismatching parentheses"
|
||||||
|
(pass-if-exception "opening parenthesis"
|
||||||
|
exception:eof
|
||||||
|
(read-string "("))
|
||||||
|
(pass-if-exception "closing parenthesis following mismatched opening"
|
||||||
|
exception:unexpected-rparen
|
||||||
|
(read-string ")"))
|
||||||
|
(pass-if-exception "opening vector parenthesis"
|
||||||
|
exception:eof
|
||||||
|
(read-string "#("))
|
||||||
|
(pass-if-exception "closing parenthesis following mismatched vector opening"
|
||||||
|
exception:unexpected-rparen
|
||||||
|
(read-string ")")))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue