diff options
| author | Nicholas Hubbard <nicholashubbard@posteo.net> | 2022-03-01 16:20:40 -0500 |
|---|---|---|
| committer | Nicholas Hubbard <nicholashubbard@posteo.net> | 2022-03-01 16:20:40 -0500 |
| commit | bfc1ae1db3f5d9752e00fb55ce21b4e0d16e5af8 (patch) | |
| tree | 10cf07ddf2d363be40ee8336657e6c2f7246b720 | |
| parent | 49c48af0ed75283d23dd91d516fdaa9fb8541563 (diff) | |
Test persp-merge and persp-unmerge.
| -rw-r--r-- | test/test-perspective.el | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test-perspective.el b/test/test-perspective.el index d5a7005..f12caa3 100644 --- a/test/test-perspective.el +++ b/test/test-perspective.el @@ -2260,4 +2260,39 @@ persp-test-make-sample-environment." (persp-test-check-sample-environment)) (persp-test-clean-files "A1" "A2" "A3" "B1" "B2" "B3" "B4" "state-1.el"))) +(ert-deftest merge-and-unmerge () + (let ((persp-merge-list nil)) + (unwind-protect + (persp-test-with-persp + (persp-test-with-files nil (A1 A2 B1 B2 C1 C2) + (with-named-persp "A" + (persp-add-buffer "A1") + (persp-add-buffer "A2") + (with-named-persp "B" + (persp-add-buffer "B1") + (persp-add-buffer "B2") + (with-named-persp "C" + (persp-add-buffer "C1") + (persp-add-buffer "C2") + ;; basic merging + (persp-merge "B" "A") + (should (equal (list (persp-scratch-buffer "B") "A1" "A2" "B1" "B2") + (sort (persp-get-buffer-names "B") #'string-lessp))) + ;; merging are not transitive + (persp-merge "C" "B") + (should (equal (list (persp-scratch-buffer "C") "B1" "B2" "C1" "C2") + (sort (persp-get-buffer-names "C") #'string-lessp))) + ;; basic unmerging + (persp-unmerge "C" "B") + (should (equal (list (persp-scratch-buffer "C") "C1" "C2") + (sort (persp-get-buffer-names "C") #'string-lessp))) + ;; don't unmerge buffers that were in base before the merge + (with-perspective "C" + (persp-add-buffer "A1")) + (persp-merge "C" "A") + (persp-unmerge "C" "A") + (should (equal (list (persp-scratch-buffer "C") "A1" "C1" "C2") + (sort (persp-get-buffer-names "C") #'string-lessp)))))))) + (persp-test-clean-files "A1" "A2" "B1" "B2" "C1" "C2")))) + ;;; test-perspective.el ends here |
