;;; test-ai-vterm--launch-command.el --- Tests for cj/--ai-vterm-launch-command -*- lexical-binding: t; -*- ;;; Commentary: ;; The launch command is what gets typed into a fresh vterm shell to bring ;; up Claude inside a per-project tmux session. The session is named ;; `cj/ai-vterm-tmux-session-prefix' + the project basename, so a second ;; F9 on the same project reattaches to the running Claude rather than ;; spawning a new one, and `tmux ls' output can be filtered to AI-vterm's ;; own sessions. The trailing `exec bash' keeps the tmux window alive if ;; Claude exits, leaving the session intact for recovery. ;;; Code: (require 'ert) (add-to-list 'load-path (expand-file-name "modules" user-emacs-directory)) (require 'ai-vterm) (ert-deftest test-ai-vterm--launch-command-uses-new-session-attach () "Normal: starts with `tmux new-session -A' so existing sessions reattach." (let ((cj/ai-vterm-claude-command "claude")) (should (string-prefix-p "tmux new-session -A " (cj/--ai-vterm-launch-command "/code/foo"))))) (ert-deftest test-ai-vterm--launch-command-includes-prefixed-session-name () "Normal: the session name is the prefixed form from the name helper." (let ((cj/ai-vterm-claude-command "claude") (cj/ai-vterm-tmux-session-prefix "aiv-")) (should (string-match-p " -s aiv-foo " (cj/--ai-vterm-launch-command "/code/foo"))))) (ert-deftest test-ai-vterm--launch-command-includes-start-directory () "Normal: `-c