aboutsummaryrefslogtreecommitdiff
path: root/tests/test-ai-vterm--show-or-create.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-11 07:18:20 -0500
committerCraig Jennings <c@cjennings.net>2026-05-11 07:18:20 -0500
commit59b0854464ef29511a0d09f1e76fd1140e675833 (patch)
tree0c18aee463b4ff14f2fa6675e2cde6fc5f50bbdc /tests/test-ai-vterm--show-or-create.el
parentde555fa8b48c5ed5f17c0a8db9de7ecb946aa75d (diff)
downloaddotemacs-59b0854464ef29511a0d09f1e76fd1140e675833.tar.gz
dotemacs-59b0854464ef29511a0d09f1e76fd1140e675833.zip
refactor(ai-vterm): rename Claude-specific names to a generic "agent"
I may add other terminal agents to this launcher (aider, an open-source LLM TUI), so the buffer prefix, the user knob, and the internal helpers shouldn't say "Claude". The module name (ai-vterm) and the `cj/ai-vterm-*` customs were already generic. This finishes the job: - buffer prefix `claude [<basename>]` -> `agent [<basename>]` (the `defconst` and the matching display-buffer-alist regex move together) - `cj/ai-vterm-claude-command` -> `cj/ai-vterm-agent-command` (the default still runs the `claude` CLI, with a docstring note on swapping it) - `cj/--ai-vterm-claude-buffers` / `-displayed-claude-window` / `-reuse-existing-claude` -> `-agent-*`, and their test files renamed to match - prose in the module commentary and docstrings, plus the matching test docstrings and buffer-name literals `vterm-config.el` hardcodes the same buffer prefix in `cj/--vterm-toggle-buffer-p` (F12 excludes agent buffers from its candidate set), so that literal moved too. Collapsing it into the shared `cj/--ai-vterm-name-prefix` is a cleanup for another day. After a reload, a project's buffer opens as `agent [foo]` instead of `claude [foo]`. Old buffers keep their names until killed. I also corrected two stale `eshell-vterm-config.el` references in ai-vterm.el docstrings (that module was split into `vterm-config.el`). Two things keep saying "Claude": the `cj/ai-vterm-agent-command` default value (the actual CLI), and the "Claude Code" example in `vterm-config.el`'s cursor-restore docstring (a concrete TUI example, not branding). 90 tests pass. `make validate-modules` clean.
Diffstat (limited to 'tests/test-ai-vterm--show-or-create.el')
-rw-r--r--tests/test-ai-vterm--show-or-create.el24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/test-ai-vterm--show-or-create.el b/tests/test-ai-vterm--show-or-create.el
index 3fee4883..0a3dbde5 100644
--- a/tests/test-ai-vterm--show-or-create.el
+++ b/tests/test-ai-vterm--show-or-create.el
@@ -3,7 +3,7 @@
;;; Commentary:
;; Tests the show-or-create branching:
;;
-;; - buffer absent -> vterm called, claude command sent
+;; - buffer absent -> vterm called, agent command sent
;; - buffer present, live -> vterm not called, buffer displayed
;; - buffer present, dead -> old buffer killed, vterm recreates
;;
@@ -58,7 +58,7 @@ VARS is a plist of capture variable names: :calls, :strings, :returns,
(ert-deftest test-ai-vterm--show-or-create-creates-when-buffer-missing ()
"Normal: no existing buffer -> vterm called once, launch cmd sent."
- (let ((name "claude [normal-create-test]"))
+ (let ((name "agent [normal-create-test]"))
(test-ai-vterm--cleanup name)
(unwind-protect
(test-ai-vterm--with-mock-vterm (:calls calls :strings strings
@@ -73,7 +73,7 @@ VARS is a plist of capture variable names: :calls, :strings, :returns,
(ert-deftest test-ai-vterm--show-or-create-displays-existing-when-process-live ()
"Normal: buffer exists with live process -> vterm not called."
- (let ((name "claude [reuse-test]"))
+ (let ((name "agent [reuse-test]"))
(test-ai-vterm--cleanup name)
(unwind-protect
(let ((buf (get-buffer-create name)))
@@ -89,7 +89,7 @@ VARS is a plist of capture variable names: :calls, :strings, :returns,
(ert-deftest test-ai-vterm--show-or-create-recreates-when-process-dead ()
"Boundary: buffer exists with dead process -> killed and recreated."
- (let ((name "claude [dead-test]"))
+ (let ((name "agent [dead-test]"))
(test-ai-vterm--cleanup name)
(unwind-protect
(let ((stale (get-buffer-create name)))
@@ -111,17 +111,17 @@ VARS is a plist of capture variable names: :calls, :strings, :returns,
Real `vterm' replaces the selected window's buffer as a side-effect of
construction. On a fresh-boot frame (one window showing the dashboard),
that side-effect previously left the original window pointing at the new
-claude buffer; the dashboard was buried, the alist-routed split then
-created a second window also showing claude. The wrapper must restore
+agent buffer; the dashboard was buried, the alist-routed split then
+created a second window also showing agent. The wrapper must restore
the original window state before `display-buffer' fires so dashboard
-stays put and the alist places claude into a fresh right-side split.
+stays put and the alist places agent into a fresh right-side split.
This test stubs `vterm' to mimic the pop-to-buffer-same-window side-effect
and asserts the originally-selected window still shows its original buffer
after `cj/--ai-vterm-show-or-create' returns."
- (let ((claude-name "claude [preserve-window-test]")
+ (let ((agent-name "agent [preserve-window-test]")
(orig-name "*test-original-buffer*"))
- (test-ai-vterm--cleanup claude-name)
+ (test-ai-vterm--cleanup agent-name)
(when (get-buffer orig-name) (kill-buffer orig-name))
(unwind-protect
(save-window-excursion
@@ -139,14 +139,14 @@ after `cj/--ai-vterm-show-or-create' returns."
(lambda (_s &optional _) nil))
((symbol-function 'vterm-send-return)
(lambda () nil)))
- (cj/--ai-vterm-show-or-create "/tmp/preserve" claude-name)
+ (cj/--ai-vterm-show-or-create "/tmp/preserve" agent-name)
(should (eq (window-buffer orig-win) orig-buf)))))
- (test-ai-vterm--cleanup claude-name)
+ (test-ai-vterm--cleanup agent-name)
(when (get-buffer orig-name) (kill-buffer orig-name)))))
(ert-deftest test-ai-vterm--show-or-create-returns-buffer ()
"Normal: return value is the vterm buffer."
- (let ((name "claude [return-test]"))
+ (let ((name "agent [return-test]"))
(test-ai-vterm--cleanup name)
(unwind-protect
(test-ai-vterm--with-mock-vterm (:calls _c :strings _s