From 27a226665e8b2d9e3911865cd0b8097a1184b8d0 Mon Sep 17 00:00:00 2001 From: Dirk Herrmann Date: Sat, 13 Oct 2001 17:02:01 +0000 Subject: [PATCH] * tests/syntax.test: Added test cases for 'case' syntax. --- test-suite/ChangeLog | 4 +++ test-suite/tests/syntax.test | 61 ++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/test-suite/ChangeLog b/test-suite/ChangeLog index dbdec40cb..52681d579 100644 --- a/test-suite/ChangeLog +++ b/test-suite/ChangeLog @@ -1,3 +1,7 @@ +2001-10-13 Dirk Herrmann + + * tests/syntax.test: Added test cases for 'case' syntax. + 2001-10-13 Dirk Herrmann * tests/numbers.test: Added a test case that checks if valid diff --git a/test-suite/tests/syntax.test b/test-suite/tests/syntax.test index 53370c9dd..e9b23ecc0 100644 --- a/test-suite/tests/syntax.test +++ b/test-suite/tests/syntax.test @@ -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"