Skip to content

Commit

Permalink
display-buffer-mark-dedicated: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bmag committed Aug 9, 2018
1 parent 4d4185f commit 15e6d44
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/switch-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,36 @@
(purpose-mode -1)))
(purpose-kill-buffers-safely "xxx-p0-0" "xxx-p0-1" "xxx-p1-0"))))

(ert-deftest purpose-test-mark-dedicated ()
"Test `purpose-change-buffer' honors `display-buffer-mark-dedicated'."
(save-window-excursion
(unwind-protect
(let ((purpose-message-on-p t))
(purpose-with-temp-config
nil nil '(("^xxx-p0-" . p0) ("^xxx-p1-" . p1))
(purpose-create-buffers-for-test :p0 1 :p1 1)
(message "testing mark-dedicated nil...")
(delete-other-windows)
(set-window-buffer nil "xxx-p0-0")
(set-window-dedicated-p nil nil)
(let* ((display-buffer-mark-dedicated nil))
(purpose-pop-buffer "xxx-p1-0")
(purpose-check-displayed-buffers '("xxx-p0-0" "xxx-p1-0"))
(should (string= "xxx-p1-0" (buffer-name (window-buffer))))
(should-not (window-dedicated-p)))

(message "testing mark-dedicated t...")
(delete-other-windows)
(set-window-buffer nil "xxx-p0-0")
(set-window-dedicated-p nil nil)
(let* ((display-buffer-mark-dedicated t))
(purpose-pop-buffer "xxx-p1-0")
(purpose-check-displayed-buffers '("xxx-p0-0" "xxx-p1-0"))
(should (string= "xxx-p1-0" (buffer-name (window-buffer))))
(should (window-dedicated-p)))))

(purpose-kill-buffers-safely "xxx-p0-0" "xxx-p1-0"))))

(ert-deftest purpose-test-pop-buffer-same-window ()
"Test variations of `purpose-pop-buffer-same-window'.
- 1 windows, switch to other purpose
Expand Down

0 comments on commit 15e6d44

Please sign in to comment.