diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2024-10-03 21:06:09 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2024-10-03 21:06:09 +0200 |
| commit | a286543c01ebe3735611b125c01baaca2b9b5218 (patch) | |
| tree | 6f46902d695450b4508464c13cb8a79c6bbaabe7 | |
| parent | 8fdcde4aafbd6d5768fa135d9e2a7bc1ae95b23a (diff) | |
Add note about need for using funcall
Add that in form of a commented test.
| -rw-r--r-- | llama-test.el | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llama-test.el b/llama-test.el index 5db9123..8f20076 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 |
