diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-09-14 02:30:54 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-09-14 02:30:54 +0200 |
commit | 10e9ec6da457ed32236ed9c70aa6cc3fdf9ae7ea (patch) | |
tree | fecbaf2e95aa24712949629b2fae685ed10508cb /test/lisp/emacs-lisp | |
parent | c4235eb26db27df63982083455f355ac9b46d70f (diff) | |
download | emacs-10e9ec6da457ed32236ed9c70aa6cc3fdf9ae7ea.tar.gz emacs-10e9ec6da457ed32236ed9c70aa6cc3fdf9ae7ea.tar.bz2 emacs-10e9ec6da457ed32236ed9c70aa6cc3fdf9ae7ea.zip |
Fix recently-added cl-macs tests
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-case-error)
(cl-case-warning): Fix warning matches.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r-- | test/lisp/emacs-lisp/cl-macs-tests.el | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 427b8f46893..83928775f18 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -752,42 +752,44 @@ collection clause." (ert-deftest cl-case-error () "Test that `cl-case' and `cl-ecase' signal an error if a t or `otherwise' key is misplaced." - (dolist (form '((cl-case val (t 1) (123 2)) - (cl-ecase val (t 1) (123 2)) - (cl-ecase val (123 2) (t 1)))) - (ert-info ((prin1-to-string form) :prefix "Form: ") - (let ((error (should-error (macroexpand form)))) - (should (equal (cdr error) - '("Misplaced t or `otherwise' clause"))))))) + (let ((text-quoting-style 'grave)) + (dolist (form '((cl-case val (t 1) (123 2)) + (cl-ecase val (t 1) (123 2)) + (cl-ecase val (123 2) (t 1)))) + (ert-info ((prin1-to-string form) :prefix "Form: ") + (let ((error (should-error (macroexpand form)))) + (should (equal (cdr error) + '("Misplaced t or `otherwise' clause")))))))) (ert-deftest cl-case-warning () "Test that `cl-case' and `cl-ecase' warn about suspicious constructs." - (pcase-dolist (`(,case . ,message) - `((nil . "Case nil will never match") - ('nil . ,(concat "Case 'nil will match `quote'. " + (let ((text-quoting-style 'grave)) + (pcase-dolist (`(,case . ,message) + `((nil . "Case nil will never match") + ('nil . ,(concat "Case 'nil will match `quote'. " + "If that's intended, write " + "(nil quote) instead. " + "Otherwise, don't quote `nil'.")) + ('t . ,(concat "Case 't will match `quote'. " "If that's intended, write " - "(nil quote) instead. " - "Otherwise, don't quote `nil'.")) - ('t . ,(concat "Case 't will match `quote'. " - "If that's intended, write " - "(t quote) instead. " - "Otherwise, don't quote `t'.")) - ('foo . ,(concat "Case 'foo will match `quote'. " - "If that's intended, write " - "(foo quote) instead. " - "Otherwise, don't quote `foo'.")) - (#'foo . ,(concat "Case #'foo will match " - "`function'. If that's " - "intended, write (foo function) " - "instead. Otherwise, don't " - "quote `foo'.")))) - (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 (equal messages - (concat "Warning: " message "\n"))))))))) + "(t quote) instead. " + "Otherwise, don't quote `t'.")) + ('foo . ,(concat "Case 'foo will match `quote'. " + "If that's intended, write " + "(foo quote) instead. " + "Otherwise, don't quote `foo'.")) + (#'foo . ,(concat "Case #'foo will match " + "`function'. If that's " + "intended, write (foo function) " + "instead. Otherwise, don't " + "quote `foo'.")))) + (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 (equal messages + (concat "Warning: " message "\n")))))))))) ;;; cl-macs-tests.el ends here |