stubAllFocusBackends replaces the per-backend PSRunner / RunnerOutput vars with stubs that flip a bool when the backend's FocusSession path runs. Restores originals on cleanup.
(t *testing.T)
| 413 | // vars with stubs that flip a bool when the backend's FocusSession |
| 414 | // path runs. Restores originals on cleanup. |
| 415 | func stubAllFocusBackends(t *testing.T) focusFlags { |
| 416 | t.Helper() |
| 417 | var itermCalled, terminalCalled, zellijCalled, kittyCalled bool |
| 418 | |
| 419 | oldITermPS := iterm.PSRunner |
| 420 | iterm.PSRunner = func() ([]byte, error) { |
| 421 | itermCalled = true |
| 422 | return []byte(""), nil // empty ps output -> ttyForClaudeSession returns "" -> (false, nil) |
| 423 | } |
| 424 | t.Cleanup(func() { iterm.PSRunner = oldITermPS }) |
| 425 | |
| 426 | oldTermPS := terminal.PSRunner |
| 427 | terminal.PSRunner = func() ([]byte, error) { |
| 428 | terminalCalled = true |
| 429 | return []byte(""), nil |
| 430 | } |
| 431 | t.Cleanup(func() { terminal.PSRunner = oldTermPS }) |
| 432 | |
| 433 | oldZellijRO := zellij.RunnerOutput |
| 434 | zellij.RunnerOutput = func(args []string) ([]byte, error) { |
| 435 | zellijCalled = true |
| 436 | return []byte("[]"), nil // empty pane list -> (false, nil) |
| 437 | } |
| 438 | t.Cleanup(func() { zellij.RunnerOutput = oldZellijRO }) |
| 439 | |
| 440 | oldKittyRO := kitty.RunnerOutput |
| 441 | kitty.RunnerOutput = func(args []string) ([]byte, error) { |
| 442 | kittyCalled = true |
| 443 | return []byte("[]"), nil // empty OS-window list -> (false, nil) |
| 444 | } |
| 445 | t.Cleanup(func() { kitty.RunnerOutput = oldKittyRO }) |
| 446 | |
| 447 | return focusFlags{ |
| 448 | iterm: &itermCalled, |
| 449 | terminal: &terminalCalled, |
| 450 | zellij: &zellijCalled, |
| 451 | kitty: &kittyCalled, |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | // TestShellQuoteParity makes sure the re-exported helper matches |
| 456 | // every backend's implementation. All backends quote identically. |
no outgoing calls
no test coverage detected