aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthew White <mehw.is.me@inventati.org>2021-07-07 15:10:49 +0000
committerMatthew White <mehw.is.me@inventati.org>2021-10-21 01:27:37 +0200
commit2522318fb19ff600e1180a1c2401421ac877c4c7 (patch)
tree1fcfcf556dbf8b031849b79d5cd1397d96f3ed90 /test
parenta6d5feb11625aed9eb171727da7ff4c89ed89f22 (diff)
basic-persp-switch-to-scratch-buffer: test *scratch* switching
New ert test designed to test 'persp-switch-to-scratch-buffer'. Test switching to a perspective's scratch buffer. Test if the scratch buffer is created when there isn't one.
Diffstat (limited to 'test')
-rw-r--r--test/test-perspective.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test-perspective.el b/test/test-perspective.el
index 7eb6f47..a4b4cde 100644
--- a/test/test-perspective.el
+++ b/test/test-perspective.el
@@ -2079,6 +2079,37 @@ buffers into any perspective."
(persp-test-kill-extra-buffers "*dummy*")
(should (get-buffer-create "*scratch*")))
+(ert-deftest basic-persp-switch-to-scratch-buffer ()
+ (persp-test-with-persp
+ ;; currently in "main" perspective
+ (switch-to-buffer "*dummy*")
+ (should (get-buffer "*scratch*"))
+ (should (equal (buffer-name) "*dummy*"))
+ ;; switch to the perspective's scratch buffer
+ (persp-switch-to-scratch-buffer)
+ (should (equal (buffer-name) "*scratch*"))
+ (switch-to-buffer "*dummy*")
+ (should (kill-buffer "*scratch*"))
+ (should-not (get-buffer "*scratch*"))
+ ;; create and switch to the perspective's scratch buffer
+ (persp-switch-to-scratch-buffer)
+ (should (equal (buffer-name) "*scratch*"))
+ (persp-switch "A")
+ (switch-to-buffer "*dummy*")
+ (should (get-buffer "*scratch* (A)"))
+ (should (equal (buffer-name) "*dummy*"))
+ ;; switch to the perspective's scratch buffer
+ (persp-switch-to-scratch-buffer)
+ (should (equal (buffer-name) "*scratch* (A)"))
+ (switch-to-buffer "*dummy*")
+ (should (kill-buffer "*scratch* (A)"))
+ (should-not (get-buffer "*scratch* (A)"))
+ ;; create and switch to the perspective's scratch buffer
+ (persp-switch-to-scratch-buffer)
+ (should (equal (buffer-name) "*scratch* (A)"))
+ (should (kill-buffer "*dummy*"))
+ (should-not (get-buffer "*dummy*"))))
+
(defmacro persp-test-make-sample-environment ()
"Make a test environment with the following window layout: