diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-18 17:16:40 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-18 17:16:40 -0500 |
| commit | 4727c52aa3fcc1ac734d6cd6d4e44a3194984179 (patch) | |
| tree | 13b3c55fd2755db124e1f99daadb64d5e9a3803c /tests | |
| parent | 31e062c574c81a4b9f4e9e72da2df3bbfbf4ef36 (diff) | |
| download | dotemacs-4727c52aa3fcc1ac734d6cd6d4e44a3194984179.tar.gz dotemacs-4727c52aa3fcc1ac734d6cd6d4e44a3194984179.zip | |
test(ai-term): close the show-or-create subprocess mock hole
- The preserve-window test now mocks the tmux and color seams.
- A recording process-file guard asserts nothing escapes.
- The tmux helper's error handler would swallow a signaling guard.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-ai-term--show-or-create.el | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/test-ai-term--show-or-create.el b/tests/test-ai-term--show-or-create.el index 9574b8a6..64e37653 100644 --- a/tests/test-ai-term--show-or-create.el +++ b/tests/test-ai-term--show-or-create.el @@ -122,7 +122,8 @@ dashboard put and letting the alist place agent into a fresh split. This test stubs `eat' to mimic the same-window side-effect and asserts the originally-selected window still shows its original buffer afterward." (let ((agent-name "agent [preserve-window-test]") - (orig-name "*test-original-buffer*")) + (orig-name "*test-original-buffer*") + (subprocess-calls nil)) (test-ai-term--cleanup agent-name) (when (get-buffer orig-name) (kill-buffer orig-name)) (unwind-protect @@ -138,9 +139,21 @@ originally-selected window still shows its original buffer afterward." (set-window-buffer (selected-window) buf) buf))) ((symbol-function 'cj/--ai-term-send-string) - (lambda (_buf _s) nil))) + (lambda (_buf _s) nil)) + ;; Same hermetic seams the shared macro mocks: no tmux + ;; subprocess for the fresh-session check, no /color timer. + ((symbol-function 'cj/--ai-term-live-tmux-sessions) + (lambda () nil)) + ((symbol-function 'cj/--ai-term-schedule-color) + (lambda (_buffer _color) nil)) + ;; Leak guard: any subprocess attempt is recorded, not run. + ;; `cj/--ai-term-live-tmux-sessions' swallows errors, so a + ;; signaling barrier would pass silently -- record and assert. + ((symbol-function 'process-file) + (lambda (&rest _) (push 'process-file subprocess-calls) -1))) (cj/--ai-term-show-or-create "/tmp/preserve" agent-name) - (should (eq (window-buffer orig-win) orig-buf))))) + (should (eq (window-buffer orig-win) orig-buf)) + (should-not subprocess-calls)))) (test-ai-term--cleanup agent-name) (when (get-buffer orig-name) (kill-buffer orig-name))))) |
