[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 10e9ec6da4: Fix recently-added cl-macs tests
From: |
Lars Ingebrigtsen |
Subject: |
master 10e9ec6da4: Fix recently-added cl-macs tests |
Date: |
Tue, 13 Sep 2022 20:31:11 -0400 (EDT) |
branch: master
commit 10e9ec6da457ed32236ed9c70aa6cc3fdf9ae7ea
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix recently-added cl-macs tests
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-case-error)
(cl-case-warning): Fix warning matches.
---
test/lisp/emacs-lisp/cl-macs-tests.el | 66 ++++++++++++++++++-----------------
1 file 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 427b8f4689..83928775f1 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 10e9ec6da4: Fix recently-added cl-macs tests,
Lars Ingebrigtsen <=