Skip to content

Commit

Permalink
Add tests for multi-jump
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdl89 committed Jul 12, 2024
1 parent 3c798e3 commit d5d5152
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion evil-jumps.el
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ change the current buffer."
(when previous-pos
(setf (evil-jumps-struct-previous-pos struct) nil)
(if (and
;; `evil-jump-backward' and 'evil-jump-forward' needs
;; `evil-jump-backward' and 'evil-jump-forward' need
;; to be handled specially. When jumping backward
;; multiple times, calling `evil-set-jump' is always
;; wrong: If you jump back twice and we call
Expand Down
25 changes: 22 additions & 3 deletions evil-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -9722,8 +9722,7 @@ parameter set."
("3\C-i") ;; even after jumping forward 3 times it can't get past the 3rd z
"z z [z] z z z z z"))
(ert-info ("Jump across files")
(let ((temp-file "evil-test-"))
(make-temp-file "evil-test-")
(let ((temp-file (make-temp-file "evil-test-")))
(unwind-protect
(evil-test-buffer
"[z] z z z z z z"
Expand All @@ -9736,7 +9735,27 @@ parameter set."
(delete-file temp-file)
(with-current-buffer (get-file-buffer temp-file)
(set-buffer-modified-p nil))
(kill-buffer (get-file-buffer temp-file)))))))
(let ((buf (file-name-nondirectory temp-file)))
(when (get-buffer buf) (kill-buffer buf))))))
(ert-info ("Jump multiple times between files")
(let ((a (make-temp-file "evil-aa-" nil nil "evil-bb\n\nthis is a"))
(b (make-temp-file "evil-bb-" nil nil "evil-cc\n\nthis is b"))
(c (make-temp-file "evil-cc-" nil nil "this is c")))
(unwind-protect
(evil-test-buffer
(find-file a)
("gf" [return])
"evil-cc\n\nthis is b"
("gf" [return])
"this is c"
("\C-o" "\C-o")
"evil-bb\n\nthis is a"
("\C-i" "\C-i")
"this is c")
(dolist (f (list a b c))
(let ((buf (file-name-nondirectory f)))
(when (get-buffer buf) (kill-buffer buf)))
(delete-file f)))))))

(ert-deftest evil-test-find-file ()
:tags '(evil jumps)
Expand Down

0 comments on commit d5d5152

Please sign in to comment.