all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#60332: [PATCH] ; whitespace: Use the new `ert-with-buffer-selected' in tests
@ 2022-12-26  5:58 Richard Hansen
  2022-12-29  9:12 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Hansen @ 2022-12-26  5:58 UTC (permalink / raw)
  To: 60332


[-- 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 --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#60332: [PATCH] ; whitespace: Use the new `ert-with-buffer-selected' in tests
  2022-12-26  5:58 bug#60332: [PATCH] ; whitespace: Use the new `ert-with-buffer-selected' in tests Richard Hansen
@ 2022-12-29  9:12 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2022-12-29  9:12 UTC (permalink / raw)
  To: Richard Hansen; +Cc: 60332-done

> Date: Mon, 26 Dec 2022 00:58:38 -0500
> From: Richard Hansen <rhansen@rhansen.org>
> 
> 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.

Thanks, installed on the emacs-29 branch.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-29  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-26  5:58 bug#60332: [PATCH] ; whitespace: Use the new `ert-with-buffer-selected' in tests Richard Hansen
2022-12-29  9:12 ` Eli Zaretskii

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.