aboutsummaryrefslogtreecommitdiff
path: root/tests/testutil-terminal-buffers.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-26 05:10:29 -0400
committerCraig Jennings <c@cjennings.net>2026-06-26 05:10:29 -0400
commiteb4aa232836f069ca671c6651a0e2f5dff4f7c34 (patch)
treec673e9a1ab78a6e561d6be92f92f27ebb2dea3be /tests/testutil-terminal-buffers.el
parent4facbbe9dec4d2a713735a80f11c412ebb53eb62 (diff)
downloaddotemacs-eb4aa232836f069ca671c6651a0e2f5dff4f7c34.tar.gz
dotemacs-eb4aa232836f069ca671c6651a0e2f5dff4f7c34.zip
refactor(term): finish ghostel retirement (phase 5)
Remove the dead ghostel app from theme-studio: the GHOSTEL_FACES/SEED data, the registry row, the renderGhostelPreview previewer, and the package_seed test, then regenerate the tool. ansi-color stays since eat inherits it. Rename testutil-ghostel-buffers to testutil-terminal-buffers and drop make-fake-ghostel-buffer; the toggle-filter test now uses the eat fixture, since agents are eat. Fix the comments that still called the agent buffers ghostel (they're eat now) in eat-config and the ai-term and auto-dim test docstrings. I also package-deleted the unused ghostel ELPA package. Full suite green; the remaining ghostel mentions are accurate migration history.
Diffstat (limited to 'tests/testutil-terminal-buffers.el')
-rw-r--r--tests/testutil-terminal-buffers.el57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/testutil-terminal-buffers.el b/tests/testutil-terminal-buffers.el
new file mode 100644
index 000000000..c2a43a3c7
--- /dev/null
+++ b/tests/testutil-terminal-buffers.el
@@ -0,0 +1,57 @@
+;;; testutil-terminal-buffers.el --- Shared helpers for terminal/agent buffer tests -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; Cleanup helpers and fake-terminal-buffer constructors (eat, eshell) used
+;; across the ai-term and term-toggle test files.
+
+;;; Code:
+
+(require 'cl-lib)
+
+(defun cj/test--call-as-gui (fn)
+ "Call FN, stubbing `env-terminal-p' to return nil (a GUI frame).
+
+The terminal refuse-guard was dropped when the terminal engine moved off vterm
+(EAT and eshell render in TTY frames too), so this no longer gates behavior; it
+is kept as a thin passthrough so window-behavior tests written against the old
+guard keep working unchanged."
+ (cl-letf (((symbol-function 'env-terminal-p) (lambda () nil)))
+ (funcall fn)))
+
+(defun cj/test--kill-buffers-matching-prefix (prefix)
+ "Kill all live buffers whose name starts with PREFIX."
+ (dolist (b (buffer-list))
+ (when (string-prefix-p prefix (buffer-name b))
+ (kill-buffer b))))
+
+(defun cj/test--kill-agent-buffers ()
+ "Kill all live buffers whose name matches the AI-term prefix \"agent [\"."
+ (cj/test--kill-buffers-matching-prefix "agent ["))
+
+(defun cj/test--kill-test-term-buffers ()
+ "Kill all live buffers whose name starts with \"*test-term\"."
+ (cj/test--kill-buffers-matching-prefix "*test-term"))
+
+(defun cj/test--make-fake-eat-buffer (name)
+ "Return a buffer named NAME with `major-mode' set to `eat-mode'.
+
+Avoids actually launching an EAT process by setting the mode buffer-locally.
+Used by the F12 toggle tests that need a buffer satisfying the eat-mode
+predicate without the side-effects of `(eat)'."
+ (let ((buf (get-buffer-create name)))
+ (with-current-buffer buf
+ (setq-local major-mode 'eat-mode))
+ buf))
+
+(defun cj/test--make-fake-eshell-buffer (name)
+ "Return a buffer named NAME with `major-mode' set to `eshell-mode'.
+
+Avoids starting a real eshell by setting the mode buffer-locally. Used by the
+F12 toggle tests that need a buffer satisfying the eshell-mode predicate."
+ (let ((buf (get-buffer-create name)))
+ (with-current-buffer buf
+ (setq-local major-mode 'eshell-mode))
+ buf))
+
+(provide 'testutil-terminal-buffers)
+;;; testutil-terminal-buffers.el ends here