       (it "kills workspace on last window"
         (quiet! (+workspace/close-window-or-workspace)
                 (+workspace/close-window-or-workspace))
-        (expect (+workspace-current-name) :to-equal persp1-name)))))
+        (expect (+workspace-current-name) :to-equal persp1-name)))
+
+    (describe "rename"
+      (it "renames the current workspace"
+        (quiet! (+workspace/rename "X"))
+        (expect (+workspace-current-name) :to-equal "X")))))

  :var (persp-auto-resume-time
        persp-auto-save-opt
        persp-switch-to-added-buffer
        in1 in2 out1 out2
        persp1 persp1-name persp2 persp2-name
        doom-before-switch-buffer-hook
        doom-after-switch-buffer-hook)

  (before-all
    (require! :feature workspaces)
    (require 'persp-mode))
  (after-all
    (unload-feature 'persp-mode t))

  (before-each
    (setq persp-auto-resume-time -1
          persp-auto-save-opt 0
          persp-switch-to-added-buffer nil
          in1 (get-buffer-create "a")
          in2 (get-buffer-create "b")
          out1 (get-buffer-create "c")
          out2 (get-buffer-create "d"))
    (doom-set-buffer-real in1 t)
    (doom-set-buffer-real out1 t)
    (let (noninteractive)
      (persp-mode +1))
    (let (persp-before-switch-functions persp-activated-functions)
      (setq persp1-name +workspaces-main
            persp1 (persp-add-new persp1-name)
            persp2-name "test"
            persp2 (persp-add-new persp2-name))
      (persp-frame-switch +workspaces-main))
    (delete-other-windows)
    (switch-to-buffer in1)
    (persp-add-buffer (list in1 in2))
    (spy-on 'persp-add-buffer :and-call-through)
    (doom|init-custom-hooks))

  (after-each
    (doom|init-custom-hooks 'disable)
    (let (kill-buffer-query-functions kill-buffer-hook)
      (mapc #'kill-buffer (list in1 in2 out1 out2)))
    (let (noninteractive)
      (mapc #'persp-kill (cdr (persp-names)))
      (persp-mode -1)))

  ;;
  (describe "switch"

      (expect (+workspace-contains-buffer-p out1) :to-be nil))
    (it "automatically adds interactively opened buffers"
      (expect (+workspace-contains-buffer-p out1) :to-be nil)
      (with-current-buffer out1 (+workspaces|auto-add-buffer))
      (expect (+workspace-contains-buffer-p out1)))
    (xit "returns a list of orphaned buffers"
      (expect (+workspace-orphaned-buffer-list) :to-contain out2)))
