From: Richard Hansen <rhansen@rhansen.org>
To: 60332@debbugs.gnu.org
Subject: bug#60332: [PATCH] ; whitespace: Use the new `ert-with-buffer-selected' in tests
Date: Mon, 26 Dec 2022 00:58:38 -0500 [thread overview]
Message-ID: <3c9fbd88-4e4a-0693-c7d1-238620ce4a39@rhansen.org> (raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 216 bytes --]
Commit 286c48137f69fa96b80d197da90c69a42df604a3 added a new
`ert-with-test-buffer-selected' macro. Use that macro in
`whitespace-mode' tests to avoid code duplication.
This modifies tests added in emacs-29.
[-- Attachment #1.1.2: 0001-whitespace-Use-the-new-ert-with-buffer-selected-in-t.patch --]
[-- Type: text/x-patch, Size: 2762 bytes --]
From 2fa997c4869b1310601e1e08a33fd77ed655c2a4 Mon Sep 17 00:00:00 2001
From: Richard Hansen <rhansen@rhansen.org>
Date: Sun, 18 Dec 2022 00:24:16 -0500
Subject: [PATCH] ; whitespace: Use the new `ert-with-buffer-selected' in tests
Commit 286c48137f69fa96b80d197da90c69a42df604a3 added a new
`ert-with-test-buffer-selected' macro. Use that macro in `whitespace-mode'
tests to avoid code duplication.
---
test/lisp/whitespace-tests.el | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el
index e4a8a34801..9a9fb55e4f 100644
--- a/test/lisp/whitespace-tests.el
+++ b/test/lisp/whitespace-tests.el
@@ -42,13 +42,6 @@ whitespace-tests--with-test-buffer
'(whitespace-mode 1))
,@body)))
-(defmacro whitespace--with-buffer-selected (buffer-or-name &rest body)
- (declare (debug (form body)) (indent 1))
- `(save-window-excursion
- (with-current-buffer (or ,buffer-or-name (current-buffer))
- (with-selected-window (display-buffer (current-buffer))
- ,@body))))
-
(defun whitespace-tests--faceup (&rest lines)
"Convenience wrapper around `faceup-test-font-lock-buffer'.
Returns non-nil if the concatenated LINES match the current
@@ -360,7 +353,7 @@ whitespace-tests--indirect-clone-breaks-base-markers
(indirect (clone-indirect-buffer (buffer-name) nil)))
(should (eq (marker-buffer whitespace-bob-marker) base))
(should (eq (marker-buffer whitespace-eob-marker) base))
- (whitespace--with-buffer-selected indirect
+ (ert-with-buffer-selected indirect
;; Mutate the indirect buffer to update its bob/eob markers.
(execute-kbd-macro (kbd "z RET M-< a")))
;; With Bug#59618, the above mutation would cause the base
@@ -388,7 +381,7 @@ whitespace-tests--indirect-clone-markers
;; because the buffer should only be killed on success.
(indirect (clone-indirect-buffer nil nil)))
(whitespace-tests--check-markers base 2 4)
- (whitespace--with-buffer-selected indirect
+ (ert-with-buffer-selected indirect
(whitespace-tests--check-markers indirect 2 4)
;; Mutate the buffer to trigger `after-change-functions' and
;; thus `whitespace--update-bob-eob'.
@@ -411,7 +404,7 @@ whitespace-tests--regular-clone-markers
;; the buffer should only be killed on success.
(clone (clone-buffer)))
(whitespace-tests--check-markers orig 2 4)
- (whitespace--with-buffer-selected clone
+ (ert-with-buffer-selected clone
(whitespace-tests--check-markers clone 2 4)
(execute-kbd-macro (kbd "z RET M-< a"))
(whitespace-tests--check-markers clone 1 8))
--
2.39.0
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2022-12-26 5:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-26 5:58 Richard Hansen [this message]
2022-12-29 9:12 ` bug#60332: [PATCH] ; whitespace: Use the new `ert-with-buffer-selected' in tests Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3c9fbd88-4e4a-0693-c7d1-238620ce4a39@rhansen.org \
--to=rhansen@rhansen.org \
--cc=60332@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.