1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

* tests/syntax.test: Added test cases for 'case' syntax.

This commit is contained in:
Dirk Herrmann 2001-10-13 17:02:01 +00:00
parent a8e8c20438
commit 27a226665e
2 changed files with 65 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2001-10-13 Dirk Herrmann <D.Herrmann@tu-bs.de>
* tests/syntax.test: Added test cases for 'case' syntax.
2001-10-13 Dirk Herrmann <D.Herrmann@tu-bs.de>
* tests/numbers.test: Added a test case that checks if valid

View file

@ -356,6 +356,67 @@
exception:bad-formals
(cond (1 => (lambda (x 1) 2))))))
(with-test-prefix "case"
(with-test-prefix "bad or missing clauses"
(pass-if-exception "(case)"
exception:bad/missing-clauses
(case))
;; FIXME: Wouldn't one rather expect a 'bad or missing clauses' error?
(pass-if-exception "(case . \"foo\")"
exception:wrong-type-arg
(case . "foo"))
(pass-if-exception "(case 1)"
exception:bad/missing-clauses
(case 1))
;; FIXME: Wouldn't one rather expect a 'bad or missing clauses' error?
(pass-if-exception "(case 1 . \"foo\")"
exception:wrong-type-arg
(case 1 . "foo"))
(pass-if-exception "(case 1 \"foo\")"
exception:bad/missing-clauses
(case 1 "foo"))
(pass-if-exception "(case 1 ())"
exception:bad/missing-clauses
(case 1 ()))
(pass-if-exception "(case 1 (\"foo\"))"
exception:bad/missing-clauses
(case 1 ("foo")))
(pass-if-exception "(case 1 (\"foo\" \"bar\"))"
exception:bad/missing-clauses
(case 1 ("foo" "bar")))
;; According to R5RS, the following one is syntactically correct.
;; (pass-if-exception "(case 1 (() \"bar\"))"
;; exception:bad/missing-clauses
;; (case 1 (() "bar")))
;; FIXME: Wouldn't one rather expect a 'bad or missing clauses' error?
(pass-if-exception "(case 1 ((2) \"bar\") . \"foo\")"
exception:wrong-type-arg
(case 1 ((2) "bar") . "foo"))
(pass-if-exception "(case 1 (else #f) ((1) #t))"
exception:bad/missing-clauses
(case 1 ((2) "bar") (else)))
;; FIXME: Wouldn't one rather expect a 'bad or missing clauses' error?
(pass-if-exception "(case 1 (else #f) . \"foo\")"
exception:wrong-type-arg
(case 1 (else #f) . "foo"))
(pass-if-exception "(case 1 (else #f) ((1) #t))"
exception:bad/missing-clauses
(case 1 (else #f) ((1) #t)))))
(with-test-prefix "define"
(with-test-prefix "missing or extra expressions"