summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hansen <rhansen@rhansen.org>2022-12-18 00:24:16 -0500
committerEli Zaretskii <eliz@gnu.org>2022-12-29 11:09:05 +0200
commit9d814bea4600ac28dcdbf9caf386467551d7d9be (patch)
treea319586231f499ad13832d2671e0d15f1b15d27a
parent909091d7578b7225601b202fb9257dedae879e9a (diff)
downloademacs-9d814bea4600ac28dcdbf9caf386467551d7d9be.tar.gz
emacs-9d814bea4600ac28dcdbf9caf386467551d7d9be.tar.bz2
emacs-9d814bea4600ac28dcdbf9caf386467551d7d9be.zip
; whitespace.el: 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. (Bug#60332) * test/lisp/whitespace-tests.el (whitespace--with-buffer-selected): Macro deleted. (whitespace-tests--indirect-clone-breaks-base-markers) (whitespace-tests--indirect-clone-markers) (whitespace-tests--regular-clone-markers): Use 'ert-with-buffer-selected'.
-rw-r--r--test/lisp/whitespace-tests.el13
1 files changed, 3 insertions, 10 deletions
diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el
index 12f6cb99a23..d72748cd0c9 100644
--- a/test/lisp/whitespace-tests.el
+++ b/test/lisp/whitespace-tests.el
@@ -42,13 +42,6 @@ nil, `whitespace-mode' is left disabled."
'(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
@@ -354,7 +347,7 @@ buffer's content."
(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
@@ -382,7 +375,7 @@ buffer's content."
;; 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'.
@@ -405,7 +398,7 @@ buffer's content."
;; 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))