From e7a28317684efce7a33f71fc3a9de6685d8fa44f Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 10 Feb 1998 20:31:33 +0000 Subject: [PATCH] evcase original commit: e99733a1906e18fc9c4007c97cba59c0e412b221 --- collects/tests/mzscheme/macrolib.ss | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/collects/tests/mzscheme/macrolib.ss b/collects/tests/mzscheme/macrolib.ss index 8b9ffbd..fdf55dd 100644 --- a/collects/tests/mzscheme/macrolib.ss +++ b/collects/tests/mzscheme/macrolib.ss @@ -70,4 +70,31 @@ (syntax-test '(local ((define x 4) (+ 1 2) (define y 10)) 1)) (syntax-test '(local [(define lambda 8)] lambda)) +(for-each syntax-test + (list '(evcase) + '(evcase 1 (a)) + '(evcase 1 (a b) a) + '(evcase 1 (a . b) a) + '(evcase 1 [else 5] [1 10]))) +(define => 17) +(test (void) 'void-evcase (with-handlers ([(lambda (x) #t) (lambda (x) 17)]) (evcase 1))) +(define save-comp (compile-allow-cond-fallthrough)) +(compile-allow-cond-fallthrough #f) +(test #t andmap (lambda (x) (= x 17)) + (list + (evcase 3 [3 17]) + (evcase 3 [(+ 1 2) 17] [3 1]) + (evcase 3 [3 4 5 17]) + (evcase 3 [4 1] [3 4 5 17]) + (evcase 3 [4 1 2 3 4] [3 4 5 17]) + (evcase 3 [4 4] [2 10] [else 17]) + (let ([else 10]) (evcase 3 [4 4] [2 10] [else 15] [3 17])) + (let ([else 3]) (evcase 3 [else 17] [2 14])) + (with-handlers ([(lambda (x) #t) (lambda (x) 17)]) (evcase 1)) + (evcase 3 [3 =>]) + (evcase 3 [3 => 17]) + (let ([=> 12]) (evcase 3 [3 => 17])) + (let ([=> 17]) (evcase 3 [3 =>])))) +(compile-allow-cond-fallthrough save-comp) + (report-errs)