aboutsummaryrefslogtreecommitdiff
path: root/tests/test-ai-term--record-mru.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-05 05:28:58 -0500
committerCraig Jennings <c@cjennings.net>2026-06-05 05:28:58 -0500
commitebdf9e466b0e1f86e9b7d76650ac32408273e7a7 (patch)
treedab9b453f3a93c324b5388b3843502a088c7ed46 /tests/test-ai-term--record-mru.el
parentc094b2e4e64530379a9cb273303308a9affcabf6 (diff)
downloaddotemacs-ebdf9e466b0e1f86e9b7d76650ac32408273e7a7.tar.gz
dotemacs-ebdf9e466b0e1f86e9b7d76650ac32408273e7a7.zip
feat(term): replace vterm with ghostel as the terminal engine
I swapped the terminal engine from vterm to ghostel (libghostty-vt) everywhere. term-config replaces vterm-config (the F12 terminal, the C-; x menu, tmux history capture), and ai-term replaces ai-vterm (the F9 Claude-agent launcher). ghostel renders the agent TUI without vterm's flicker under heavy streaming, and one engine now covers every terminal workflow. Two behavior changes fall out of the swap. F9 launches in a terminal frame now: ghostel renders in TTY frames, so the old GUI-only guard is gone. Terminal windows no longer dim when unfocused: ghostel resolves its palette into the native module per-terminal, so there's no per-window color hook to dim through the way vterm had. auto-dim drops its vterm color-advice path, the dashboard Terminal button launches ghostel, and the vterm and vterm-toggle packages are removed. The tmux pane-history and copy-mode machinery carried over unchanged. It keys on the pty tty, which ghostel exposes.
Diffstat (limited to 'tests/test-ai-term--record-mru.el')
-rw-r--r--tests/test-ai-term--record-mru.el48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/test-ai-term--record-mru.el b/tests/test-ai-term--record-mru.el
new file mode 100644
index 00000000..e00f6814
--- /dev/null
+++ b/tests/test-ai-term--record-mru.el
@@ -0,0 +1,48 @@
+;;; test-ai-term--record-mru.el --- Tests for the AI-term project MRU list -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; `cj/--ai-term-record-mru' tracks which project dirs have been opened via
+;; the launcher this session, most-recently-opened first, so the picker can
+;; surface recently-used projects at the top of the active-sessions group.
+;; `cj/--ai-term-mru-rank' reports a dir's position in that list (or nil).
+
+;;; Code:
+
+(require 'ert)
+
+(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
+(require 'ai-term)
+
+(ert-deftest test-ai-term--record-mru-pushes-to-front ()
+ "Normal: a freshly recorded dir leads the list, newest first."
+ (let ((cj/--ai-term-mru nil))
+ (cj/--ai-term-record-mru "/c/alpha")
+ (cj/--ai-term-record-mru "/c/beta")
+ (should (equal cj/--ai-term-mru '("/c/beta" "/c/alpha")))))
+
+(ert-deftest test-ai-term--record-mru-dedups-and-moves-to-front ()
+ "Normal: re-recording a dir moves it to the front with no duplicate."
+ (let ((cj/--ai-term-mru nil))
+ (cj/--ai-term-record-mru "/c/alpha")
+ (cj/--ai-term-record-mru "/c/beta")
+ (cj/--ai-term-record-mru "/c/alpha")
+ (should (equal cj/--ai-term-mru '("/c/alpha" "/c/beta")))))
+
+(ert-deftest test-ai-term--record-mru-normalizes-trailing-slash ()
+ "Boundary: `/c/foo' and `/c/foo/' are the same MRU entry."
+ (let ((cj/--ai-term-mru nil))
+ (cj/--ai-term-record-mru "/c/foo/")
+ (cj/--ai-term-record-mru "/c/foo")
+ (should (equal cj/--ai-term-mru '("/c/foo")))))
+
+(ert-deftest test-ai-term--mru-rank-returns-index-or-nil ()
+ "Normal/Boundary: rank is the list position; nil when the dir isn't there;
+the lookup normalizes a trailing slash the same way `record-mru' does."
+ (let ((cj/--ai-term-mru '("/c/beta" "/c/alpha")))
+ (should (= 0 (cj/--ai-term-mru-rank "/c/beta")))
+ (should (= 1 (cj/--ai-term-mru-rank "/c/alpha")))
+ (should (= 0 (cj/--ai-term-mru-rank "/c/beta/")))
+ (should-not (cj/--ai-term-mru-rank "/c/gamma"))))
+
+(provide 'test-ai-term--record-mru)
+;;; test-ai-term--record-mru.el ends here