Skip to content

Commit

Permalink
[REF] Move buffer setting to typewriter-roll--fix-ert-window
Browse files Browse the repository at this point in the history
It seems the window isn't set/changed for temp buffer in ERT.
  • Loading branch information
KeyWeeUsr committed Aug 17, 2024
1 parent 1c829f6 commit 86ae4e9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions typewriter-roll-mode-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
(line-number-at-pos))
(defun typewriter-roll--top-line ()
(line-number-at-pos (window-start)))
(defun typewriter-roll--fix-ert-window ()
;; (error "‘recenter’ing a window that does not display current-buffer.")
(switch-to-buffer (current-buffer)))

(ert-deftest trm-backspace ()
(should (not
Expand All @@ -22,7 +25,7 @@
(let ((scroll-margin 0)
(typewriter-roll-keep-in-focus 0))
(with-temp-buffer
(switch-to-buffer (current-buffer))
(typewriter-roll--fix-ert-window)
(let* ((old-win-start (window-start))
(old-win-end (window-end))
(old-text "text text")
Expand Down Expand Up @@ -70,7 +73,7 @@ that line should be the only one visible on top."
(typewriter-roll-keep-in-focus 0)
(typewriter-roll-prefer-scroll-margin nil))
(with-temp-buffer
(switch-to-buffer (current-buffer))
(typewriter-roll--fix-ert-window)
(let* ((old-win-start (window-start))
(old-win-end (window-end))
(old-text "text text")
Expand Down Expand Up @@ -123,7 +126,7 @@ keep one more line visible above."
(typewriter-roll-keep-in-focus 1)
(typewriter-roll-prefer-scroll-margin nil))
(with-temp-buffer
(switch-to-buffer (current-buffer))
(typewriter-roll--fix-ert-window)
(let* ((old-win-start (window-start))
(old-win-end (window-end))
(old-text "text text")
Expand Down Expand Up @@ -177,7 +180,7 @@ but keep one more line visible above."
(typewriter-roll-keep-in-focus 0)
(typewriter-roll-prefer-scroll-margin t))
(with-temp-buffer
(switch-to-buffer (current-buffer))
(typewriter-roll--fix-ert-window)
(let* ((old-win-start (window-start))
(old-win-end (window-end))
(old-text "text text")
Expand Down Expand Up @@ -231,7 +234,7 @@ that line should be the only one visible on top."
(typewriter-roll-keep-in-focus 0)
(typewriter-roll-prefer-scroll-margin t))
(with-temp-buffer
(switch-to-buffer (current-buffer))
(typewriter-roll--fix-ert-window)
(let* ((old-win-start (window-start))
(old-win-end (window-end))
(old-text "text text")
Expand Down

0 comments on commit 86ae4e9

Please sign in to comment.