branch: elpa/llama
commit a286543c01ebe3735611b125c01baaca2b9b5218
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
Add note about need for using funcall
Add that in form of a commented test.
---
llama-test.el | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/llama-test.el b/llama-test.el
index 5db9123271..8f2007645f 100644
--- a/llama-test.el
+++ b/llama-test.el
@@ -456,6 +456,28 @@
(should-error (##list %1 %))
)
+(ert-deftest llama-test-904-errors-syntax nil
+
+ ;; ((lambda (%) (+ 1 %)) 2)
+ ;; results in
+ ;; Warning: Use of deprecated ((lambda (%) ...) ...) form
+ ;; but works.
+
+ ;; ((##+ 1 %) 2)
+ ;; results at compile-time in
+ ;; Warning: Malformed function ‘(## + 1 %)’
+ ;; results at run-time in
+ ;; Error: invalid-function ((## + 1 %))
+ ;; and cannot possibly work.
+
+ ;; Delay macro-expansion for demonstration purposes.
+ (should-error (eval '((##+ 1 %) 2)))
+
+ ;; This is what one should be doing instead.
+ (should (equal (funcall (lambda (%) (+ 1 %)) 2) 3))
+ (should (equal (funcall (## + 1 %) 2) 3))
+ )
+
;; Local Variables:
;; eval: (prettify-symbols-mode -1)
;; indent-tabs-mode: nil