diff options
| author | Philipp Stephani | 2022-09-19 13:34:51 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2022-09-19 13:34:51 +0200 |
| commit | a71de4b52d3de14349ded7d88c4cae6e2a9376ae (patch) | |
| tree | 9fa8895e0b37a59a8977112c03fa9ff594ec45c5 /test | |
| parent | f735aa0f3954750df799fce3452b56e5bdac2184 (diff) | |
| download | emacs-a71de4b52d3de14349ded7d88c4cae6e2a9376ae.tar.gz emacs-a71de4b52d3de14349ded7d88c4cae6e2a9376ae.zip | |
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.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/cl-macs-tests.el | 11 |
1 files changed, 11 insertions, 0 deletions
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." | |||
| 792 | (should (equal messages | 792 | (should (equal messages |
| 793 | (concat "Warning: " message "\n")))))))))) | 793 | (concat "Warning: " message "\n")))))))))) |
| 794 | 794 | ||
| 795 | (ert-deftest cl-case-no-warning () | ||
| 796 | "Test that `cl-case' and `cl-ecase' don't warn in some valid cases. | ||
| 797 | See Bug#57915." | ||
| 798 | (dolist (case '(quote (quote) function (function))) | ||
| 799 | (dolist (macro '(cl-case cl-ecase)) | ||
| 800 | (let ((form `(,macro val (,case 1)))) | ||
| 801 | (ert-info ((prin1-to-string form) :prefix "Form: ") | ||
| 802 | (ert-with-message-capture messages | ||
| 803 | (macroexpand form) | ||
| 804 | (should (string-empty-p messages)))))))) | ||
| 805 | |||
| 795 | ;;; cl-macs-tests.el ends here | 806 | ;;; cl-macs-tests.el ends here |