diff options
author | Daniel Kraft <d@domob.eu> | 2009-07-18 18:38:42 +0200 |
---|---|---|
committer | Daniel Kraft <d@domob.eu> | 2009-07-18 18:38:42 +0200 |
commit | 7d1a978289c75efbb99684c4feb29dfb10cf1229 (patch) | |
tree | 23bc4cfb13578480aca3d90facb1d8f53971407c /test-suite/tests/elisp-compiler.test | |
parent | 570c12aca7dcab2adb60bd56319dcfc3e0d6379b (diff) | |
download | guile-7d1a978289c75efbb99684c4feb29dfb10cf1229.tar.gz |
Implemented unless, when and dotimes using built-in macros.
* module/language/elisp/README: Document that.
* module/language/elisp/runtime.scm: Defined built-in-macro macro.
* module/language/elisp/runtime/macro-slot.scm: Implement unless, when, dotimes.
* test-suite/tests/elisp-compiler.test: Test for those constructs.
Diffstat (limited to 'test-suite/tests/elisp-compiler.test')
-rw-r--r-- | test-suite/tests/elisp-compiler.test | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/test-suite/tests/elisp-compiler.test b/test-suite/tests/elisp-compiler.test index 1705a971e..d36f47c77 100644 --- a/test-suite/tests/elisp-compiler.test +++ b/test-suite/tests/elisp-compiler.test @@ -56,12 +56,24 @@ (pass-if-equal "succeeding if" 1 (if t 1 2)) - (pass-if-equal "failing if" 3 - (if nil - 1 - (setq a 2) - (setq a (1+ a)) - a)) + (pass-if "failing if" + (and (= (if nil + 1 + (setq a 2) (setq a (1+ a)) a) + 3) + (equal (if nil 1) nil))) + + (pass-if-equal "failing when" nil-value + (when nil 1 2 3)) + (pass-if-equal "succeeding when" 42 + (progn (setq a 0) + (when t (setq a 42) a))) + + (pass-if-equal "failing unless" nil-value + (unless t 1 2 3)) + (pass-if-equal "succeeding unless" 42 + (progn (setq a 0) + (unless nil (setq a 42) a))) (pass-if-equal "empty cond" nil-value (cond)) @@ -101,7 +113,16 @@ (while (<= i 5) (setq prod (* i prod)) (setq i (1+ i))) - prod))) + prod)) + + (pass-if "dotimes" + (progn (setq a 0) + (setq count 100) + (setq b (dotimes (i count) + (setq j (1+ i)) + (setq a (+ a j)))) + (setq c (dotimes (i 10 42) nil)) + (and (= a 5050) (equal b nil) (= c 42))))) ; Test handling of variables. |