summaryrefslogtreecommitdiff
path: root/test-suite/tests/elisp-compiler.test
diff options
context:
space:
mode:
authorDaniel Kraft <d@domob.eu>2009-07-18 17:32:59 +0200
committerDaniel Kraft <d@domob.eu>2009-07-18 17:32:59 +0200
commit9b5ff6a6e1da0d2c20b44aa12c92a68a414e8f70 (patch)
tree8b0693a8c28e6122bc607f659e9bd4bfaa78fd4d /test-suite/tests/elisp-compiler.test
parente905e490fae68bd87ec66b35235b02c61cdace40 (diff)
downloadguile-9b5ff6a6e1da0d2c20b44aa12c92a68a414e8f70.tar.gz
Implemented real quotation (added support for backquotation).
* module/language/elisp/README: Document that. * module/language/elisp/compile-tree-il.scm: Implement backquote. * test-suite/tests/elisp-compiler.test: Test quotation and backquotes.
Diffstat (limited to 'test-suite/tests/elisp-compiler.test')
-rw-r--r--test-suite/tests/elisp-compiler.test28
1 files changed, 28 insertions, 0 deletions
diff --git a/test-suite/tests/elisp-compiler.test b/test-suite/tests/elisp-compiler.test
index af928c5df..b77cbd344 100644
--- a/test-suite/tests/elisp-compiler.test
+++ b/test-suite/tests/elisp-compiler.test
@@ -211,6 +211,34 @@
(zerop a)))))
+; Quoting and Backquotation.
+; ==========================
+
+(with-test-prefix/compile "Quotation"
+
+ (pass-if "quote"
+ (and (equal '42 42) (equal '"abc" "abc")
+ (equal '(1 2 (3 (4) x)) '(1 2 (3 (4) x)))
+ (not (equal '(1 2 (3 4 (x))) '(1 2 3 4 x)))
+ (equal '(1 2 . 3) '(1 2 . 3))))
+
+ (pass-if "simple backquote"
+ (and (equal (\` 42) 42)
+ (equal (\` (1 (a))) '(1 (a)))
+ (equal (\` (1 . 2)) '(1 . 2))))
+ (pass-if "unquote"
+ (progn (setq a 42 l '(18 12))
+ (and (equal (\` (\, a)) 42)
+ (equal (\` (1 a ((\, l)) . (\, a))) '(1 a ((18 12)) . 42)))))
+ (pass-if "unquote splicing"
+ (progn (setq l '(18 12) empty '())
+ (and (equal (\` (\,@ l)) '(18 12))
+ (equal (\` (l 2 (3 (\,@ l)) ((\,@ l)) (\,@ l)))
+ '(l 2 (3 18 12) (18 12) 18 12))
+ (equal (\` (1 2 (\,@ empty) 3)) '(1 2 3))))))
+
+
+
; Macros.
; =======