From dab977affcf1712e2b1b7594455ad25497bf279e Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 25 Jun 2026 09:00:22 -0400 Subject: test(ai-term): isolate layout-capture globals in collapse-split tests The multi-window and single-window collapse tests call cj/ai-term, which captures the current layout into cj/--ai-term-last-direction / cj/--ai-term-last-size on toggle-off, but only let-bound cj/--ai-term-last-was-bury. They leaked last-direction into the display-rule test, whose display-saved action reads those globals to choose the split direction, so its agent buffer split below instead of right and the assertion failed. Let-bind last-direction and last-size to nil, matching the roundtrip test in the same file. Full ai-term suite is green. --- tests/test-ai-term--collapse-split.el | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test-ai-term--collapse-split.el b/tests/test-ai-term--collapse-split.el index d7b4ee17f..a09af5598 100644 --- a/tests/test-ai-term--collapse-split.el +++ b/tests/test-ai-term--collapse-split.el @@ -59,7 +59,12 @@ different agent (stale quit-restore after slot reuse)." (agent-a (get-buffer-create "agent [collapse-a]")) (agent-b (get-buffer-create "agent [collapse-b]")) (agent-c (get-buffer-create "agent [collapse-c]")) - (cj/--ai-term-last-was-bury nil)) + (cj/--ai-term-last-was-bury nil) + ;; Isolate the layout-capture globals cj/ai-term writes on toggle-off, + ;; so this test doesn't leak last-direction/last-size into others -- the + ;; display-rule test splits via display-saved, which reads them. + (cj/--ai-term-last-direction nil) + (cj/--ai-term-last-size nil)) (unwind-protect (save-window-excursion (delete-other-windows) @@ -89,7 +94,12 @@ to a NON-agent buffer (the working file), never another agent. Before the fix, (let ((work (get-buffer-create "*test-collapse-sw-work*")) (agent-a (get-buffer-create "agent [collapse-sw-a]")) (agent-b (get-buffer-create "agent [collapse-sw-b]")) - (cj/--ai-term-last-was-bury nil)) + (cj/--ai-term-last-was-bury nil) + ;; Isolate the layout-capture globals cj/ai-term writes on toggle-off, + ;; so this test doesn't leak last-direction/last-size into others -- the + ;; display-rule test splits via display-saved, which reads them. + (cj/--ai-term-last-direction nil) + (cj/--ai-term-last-size nil)) (unwind-protect (save-window-excursion (delete-other-windows) -- cgit v1.2.3