diff options
| author | Matthew White <mehw.is.me@inventati.org> | 2021-07-07 15:10:49 +0000 |
|---|---|---|
| committer | Matthew White <mehw.is.me@inventati.org> | 2021-10-21 01:27:37 +0200 |
| commit | 2522318fb19ff600e1180a1c2401421ac877c4c7 (patch) | |
| tree | 1fcfcf556dbf8b031849b79d5cd1397d96f3ed90 | |
| parent | a6d5feb11625aed9eb171727da7ff4c89ed89f22 (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.
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | test/test-perspective.el | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d59408..c23946c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### ERT tests added +- `basic-persp-switch-to-scratch-buffer`: evaluate `persp-switch-to-scratch-buffer`. - `basic-persp-get-scratch-buffer`: test scratch buffers conformity and creation. - `basic-persp-forget-buffer`: evaluate `persp-forget-buffer`. - `basic-persp-killing-buffers`: test killing buffers, a perspective's last left live buffer should not be killable/removable. 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: |
