summaryrefslogtreecommitdiff
path: root/test-suite/tests/elisp-compiler.test
diff options
context:
space:
mode:
Diffstat (limited to 'test-suite/tests/elisp-compiler.test')
-rw-r--r--test-suite/tests/elisp-compiler.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/test-suite/tests/elisp-compiler.test b/test-suite/tests/elisp-compiler.test
index e475045e8..d70dd9fe5 100644
--- a/test-suite/tests/elisp-compiler.test
+++ b/test-suite/tests/elisp-compiler.test
@@ -147,6 +147,28 @@
(equal mylist '(7 2 5))
(equal b 5)))))
+(with-test-prefix/compile "Exceptions"
+
+ (pass-if "catch without exception"
+ (and (setq a 0)
+ (= (catch 'foobar
+ (setq a (1+ a))
+ (setq a (1+ a))
+ a)
+ 2)
+ (= (catch (+ 1 2) a) 2)))
+
+ ; FIXME: Figure out how to do this...
+ ;(pass-if-exception "uncaught exception" 'elisp-exception
+ ; (throw 'abc 1))
+
+ (pass-if "catch and throw"
+ (and (setq mylist '(1 2))
+ (= (catch 'abc (throw 'abc 2) 1) 2)
+ (= (catch 'abc (catch 'def (throw 'abc 1) 2) 3) 1)
+ (= (catch 'abc (catch 'def (throw 'def 1) 2) 3) 3)
+ (= (catch mylist (catch '(1 2) (throw mylist 1) 2) 3) 1))))
+
; Test handling of variables.
; ===========================