diff options
author | Daniel Kraft <d@domob.eu> | 2009-07-22 12:23:03 +0200 |
---|---|---|
committer | Daniel Kraft <d@domob.eu> | 2009-07-22 12:23:03 +0200 |
commit | 35b2e41d6d8040251a5775fc33d7158b9598ea1c (patch) | |
tree | 5d55ca29aade1dc33e90534a06e9d534a4d278af /test-suite/tests/elisp-compiler.test | |
parent | 5d221ca375e5bd762b0b8fb16b22118d2a077de9 (diff) | |
download | guile-35b2e41d6d8040251a5775fc33d7158b9598ea1c.tar.gz |
Implemented catch and throw in elisp.
* module/language/elisp/README: Document this.
* module/language/elisp/compile-tree-il.scm: Implement catch and throw.
* test-suite/tests/elisp-compiler.test: Test catch/throw.
Diffstat (limited to 'test-suite/tests/elisp-compiler.test')
-rw-r--r-- | test-suite/tests/elisp-compiler.test | 22 |
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. ; =========================== |