summaryrefslogtreecommitdiff
path: root/test-suite/tests/elisp-compiler.test
diff options
context:
space:
mode:
authorDaniel Kraft <d@domob.eu>2009-07-23 14:09:55 +0200
committerDaniel Kraft <d@domob.eu>2009-07-23 14:09:55 +0200
commit3709984696eaba6698318312ceaf9997f3b1c4fd (patch)
treedda331ce11b7bb46ad9c2626468b1ebc559133ee /test-suite/tests/elisp-compiler.test
parent33da12eeff22c5b460fc01f2e0e8fe8f85a1d220 (diff)
downloadguile-3709984696eaba6698318312ceaf9997f3b1c4fd.tar.gz
Implemented dynamic symbol access built-ins (set, fset, symbol-value, makunbound...)
* module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Moved ensure-fluid! to runtime function. * module/language/elisp/runtime.scm: Runtime functions to support dynamic value access. * module/language/elisp/runtime/function-slot.scm: Defined the built-ins. * test-suite/tests/elisp-compiler.test: Test them.
Diffstat (limited to 'test-suite/tests/elisp-compiler.test')
-rw-r--r--test-suite/tests/elisp-compiler.test34
1 files changed, 29 insertions, 5 deletions
diff --git a/test-suite/tests/elisp-compiler.test b/test-suite/tests/elisp-compiler.test
index cb87840a3..67dbc70ed 100644
--- a/test-suite/tests/elisp-compiler.test
+++ b/test-suite/tests/elisp-compiler.test
@@ -191,9 +191,19 @@
(pass-if-equal "setq and reference" 6
(progn (setq a 1 b 2 c 3)
(+ a b c)))
-
(pass-if-equal "setq value" 2
- (progn (setq a 1 b 2))))
+ (progn (setq a 1 b 2)))
+
+ (pass-if "set and symbol-value"
+ (progn (setq myvar 'a)
+ (and (= (set myvar 42) 42)
+ (= a 42)
+ (= (symbol-value myvar) 42))))
+ (pass-if "void variables"
+ (progn (setq a 1 b 2)
+ (and (eq (makunbound 'b) 'b)
+ (boundp 'a)
+ (not (boundp 'b))))))
(with-test-prefix/compile "Let and Let*"
@@ -235,9 +245,9 @@
(progn (setq a 42)
(defvar a 1 "Some docstring is also ok")
a))
- ; FIXME: makunbound a!
(pass-if-equal "defvar on undefined variable" 1
- (progn (defvar a 1)
+ (progn (makunbound 'a)
+ (defvar a 1)
a))
(pass-if-equal "defvar value" 'a
(defvar a)))
@@ -267,7 +277,21 @@
(progn (defun test (a b) (+ a b))
(test 1 2)))
(pass-if-equal "defun value" 'test
- (defun test (a b) (+ a b))))
+ (defun test (a b) (+ a b)))
+
+ (pass-if "fset and symbol-function"
+ (progn (setq myfunc 'x x 5)
+ (and (= (fset myfunc 42) 42)
+ (= (symbol-function myfunc) 42)
+ (= x 5))))
+ (pass-if "void function values"
+ (progn (setq a 1)
+ (defun test (a b) (+ a b))
+ (fmakunbound 'a)
+ (fset 'b 5)
+ (and (fboundp 'b) (fboundp 'test)
+ (not (fboundp 'a))
+ (= a 1)))))
(with-test-prefix/compile "Calling Functions"