From a71de4b52d3de14349ded7d88c4cae6e2a9376ae Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Mon, 19 Sep 2022 13:34:51 +0200 Subject: Improve check for misleading 'cl-case' cases (Bug#57915). * lisp/emacs-lisp/cl-macs.el (cl-case): Check that the case is of the form (quote FOO), not just (quote). * test/lisp/emacs-lisp/cl-macs-tests.el (cl-case-no-warning): New unit test. --- test/lisp/emacs-lisp/cl-macs-tests.el | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/lisp/emacs-lisp/cl-macs-tests.el') diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 83928775f18..f742637ee35 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -792,4 +792,15 @@ constructs." (should (equal messages (concat "Warning: " message "\n")))))))))) +(ert-deftest cl-case-no-warning () + "Test that `cl-case' and `cl-ecase' don't warn in some valid cases. +See Bug#57915." + (dolist (case '(quote (quote) function (function))) + (dolist (macro '(cl-case cl-ecase)) + (let ((form `(,macro val (,case 1)))) + (ert-info ((prin1-to-string form) :prefix "Form: ") + (ert-with-message-capture messages + (macroexpand form) + (should (string-empty-p messages)))))))) + ;;; cl-macs-tests.el ends here -- cgit v1.2.3