aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStefan Monnier2023-07-19 11:29:32 -0400
committerStefan Monnier2023-07-21 11:48:42 -0400
commitca4bc9baf9d2c861ad776da07e56381da8e3722a (patch)
tree17550fdaa0e733f33223b511cc456e30561629ca /test
parentb9a910a701a792825462a75332a9aec6824fe874 (diff)
downloademacs-ca4bc9baf9d2c861ad776da07e56381da8e3722a.tar.gz
emacs-ca4bc9baf9d2c861ad776da07e56381da8e3722a.zip
macroexp.el: Fix missing warning for intermediate expansions
When a macro expanded to a call to an obsolete macro, we failed to emit a warning for that use of the obsolete macro. * lisp/emacs-lisp/macroexp.el (macroexp-macroexpand): Use `macroexpand-1` to check obsolecence of intermediate expansions. * test/lisp/emacs-lisp/macroexp-tests.el (macroexp--test-obsolete-macro): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/macroexp-tests.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/macroexp-tests.el b/test/lisp/emacs-lisp/macroexp-tests.el
index 7bb38fe58f7..d0efbfd28c1 100644
--- a/test/lisp/emacs-lisp/macroexp-tests.el
+++ b/test/lisp/emacs-lisp/macroexp-tests.el
@@ -124,4 +124,20 @@
124 (dyn dyn dyn dyn) 124 (dyn dyn dyn dyn)
125 (dyn dyn dyn lex)))))) 125 (dyn dyn dyn lex))))))
126 126
127(defmacro macroexp--test-macro1 ()
128 (declare (obsolete "new-replacement" nil))
129 1)
130
131(defmacro macroexp--test-macro2 ()
132 '(macroexp--test-macro1))
133
134(ert-deftest macroexp--test-obsolete-macro ()
135 (should
136 (let ((res
137 (cl-letf (((symbol-function 'message) #'user-error))
138 (condition-case err
139 (macroexpand-all '(macroexp--test-macro2))
140 (user-error (error-message-string err))))))
141 (should (and (stringp res) (string-match "new-replacement" res))))))
142
127;;; macroexp-tests.el ends here 143;;; macroexp-tests.el ends here