summaryrefslogtreecommitdiff
path: root/Lisp/tests.lisp
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-03-02 20:53:39 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-03-02 20:53:39 +0100
commitfbc1ec5ed1a48ee3536849eb3665c9275c3986fd (patch)
tree87e34bed93a79714c5dd933a31f8afb4c6655af2 /Lisp/tests.lisp
parent5ce666fc19c76a234df7819e9be1d2cb07c0c6cf (diff)
Fix the compiler macro for INVOKE.
darcs-hash:f76cc3530507e408704652d52b86b434e508c18d
Diffstat (limited to 'Lisp/tests.lisp')
-rw-r--r--Lisp/tests.lisp35
1 files changed, 35 insertions, 0 deletions
diff --git a/Lisp/tests.lisp b/Lisp/tests.lisp
index 0bdd750..f5344df 100644
--- a/Lisp/tests.lisp
+++ b/Lisp/tests.lisp
@@ -361,6 +361,41 @@
'self)))))
+(deftest compiler-macros ()
+ (flet ((compiler-macroexpand-1 (form &optional environment)
+ (funcall (or (compiler-macro-function (car form))
+ #'(lambda (x y) (declare (ignore y)) x))
+ form
+ environment)))
+ (is (equal (compiler-macroexpand-1 '(invoke x :is-equal y) nil)
+ `(invoke-by-name x (selector '(:is-equal)) y)))
+ (is (equal (compiler-macroexpand-1 '(invoke x 'self))
+ `(invoke-by-name x (selector '(self)))))
+ (is (equal (compiler-macroexpand-1 `(invoke x
+ :string-with-c-string "Mulk."
+ :encoding 4))
+ `(invoke-by-name x
+ (selector '(:string-with-c-string :encoding))
+ "Mulk."
+ 4)))
+ (is (equal (compiler-macroexpand-1 `(invoke-by-name (+ 1 2) 'self))
+ `(invoke-by-name (+ 1 2) (selector 'self))))
+ (is (equal (compiler-macroexpand-1 `(invoke-by-name (+ 1 2) '(:foo :bar)
+ x y))
+ `(invoke-by-name (+ 1 2) (selector '(:foo :bar)) x y)))
+ (is (equal (compiler-macroexpand-1 `(primitive-invoke (+ 1 2) '(:foo :bar)
+ x y))
+ `(primitive-invoke (+ 1 2) (selector '(:foo :bar)) x y)))
+ (is (equal (car (compiler-macroexpand-1 `(selector '(:foo :bar))))
+ 'load-time-value))
+ (is (not (equal (car (compiler-macroexpand-1 `(selector (:foo :bar))))
+ 'load-time-value)))
+ (is (not (equal (car (compiler-macroexpand-1 `(selector (car '(:foo :bar)))))
+ 'load-time-value)))
+ (is (not (equal (car (compiler-macroexpand-1 `(selector `(,x ,y))))
+ 'load-time-value)))))
+
+
(defvar *class-counter* 0)