diff options
| author | gcv <gepardcv@gmail.com> | 2019-09-27 13:26:21 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-27 13:26:21 -0700 |
| commit | 72dae294ffae0f50aafc81a1a119740981a770fb (patch) | |
| tree | 7f57417e43afff3503b318a31ecb8e9a30611751 /test | |
| parent | 2d0d00344af48be70c2f27747aeffeef7f398360 (diff) | |
| parent | bc3be6be01feb6f9b219733ae90153498d6a5951 (diff) | |
Merge pull request #98 from nex3/tweak-test-setup
Tweak test setup
Diffstat (limited to 'test')
| -rw-r--r-- | test/test-perspective.el | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/test/test-perspective.el b/test/test-perspective.el index 20f47c7..04fbec5 100644 --- a/test/test-perspective.el +++ b/test/test-perspective.el @@ -14,7 +14,6 @@ (require 'cl-lib) (require 'ert) -(persp-mode 1) ;; Set frame size so that splitting windows doesn't result in pesky ;; ;; "Window ... too small for splitting" @@ -23,6 +22,20 @@ (set-frame-height (selected-frame) 80) (set-frame-width (selected-frame) 160) +(defmacro persp-test-with-persp (&rest body) + "Allow multiple tests to run with reasonable assumption of + isolation. This macro assumes persp-mode is turned off, then + turns on persp-mode, evaluates the body, and finally remove + all perspectives and open buffers." + (declare (indent 0)) + `(progn + (persp-mode 1) + ,@body + (persp-mode -1) + (cl-flet ((new-fns-filter (b) (or (string-equal "*Messages*" (buffer-name b)) + (string-equal "*scratch*" (buffer-name b))))) + (mapc #'kill-buffer (remove-if #'new-fns-filter (buffer-list)))))) + (defmacro persp-test-with-temp-buffers (vars &rest body) "Bind temporary buffers to VARS and evaluate BODY." (declare (indent 1)) @@ -38,7 +51,8 @@ (progn ,@body) ,@cleanup)))) -(ert-deftest issue-85 () +(ert-deftest issue-85-pulling-buffers-into-other-persps () + (persp-test-with-persp (persp-test-with-temp-buffers (A1 A2 B1) (persp-switch "A") (select-window (split-window-right)) @@ -53,6 +67,6 @@ (kill-buffer) (walk-windows (lambda (w) (should-not - (memq (window-buffer w) (list A1 A2))))))) + (memq (window-buffer w) (list A1 A2)))))))) ;;; test-perspective.el ends here |
