TestSpawnTabBasicNoEnv verifies the two-call argv sequence with no env vars: 1. RunnerOutput: kitty @ launch --type=tab --tab-title= --cwd= (returns window id) 2. Runner: kitty @ send-text --match=id: " \n" (leading space for histignorespace)
(t *testing.T)
| 12 | // 1. RunnerOutput: kitty @ launch --type=tab --tab-title=<t> --cwd=<cwd> (returns window id) |
| 13 | // 2. Runner: kitty @ send-text --match=id:<id> " <command>\n" (leading space for histignorespace) |
| 14 | func TestSpawnTabBasicNoEnv(t *testing.T) { |
| 15 | var launchArgs []string |
| 16 | stubRunnerOutput(t, func(args []string) ([]byte, error) { |
| 17 | launchArgs = append([]string(nil), args...) |
| 18 | return []byte("42\n"), nil |
| 19 | }) |
| 20 | |
| 21 | var sendArgs []string |
| 22 | old := Runner |
| 23 | Runner = func(args []string) error { |
| 24 | sendArgs = append([]string(nil), args...) |
| 25 | return nil |
| 26 | } |
| 27 | t.Cleanup(func() { Runner = old }) |
| 28 | |
| 29 | if err := SpawnTab("my-task", "/tmp", "echo hi", nil); err != nil { |
| 30 | t.Fatalf("SpawnTab: %v", err) |
| 31 | } |
| 32 | |
| 33 | wantLaunch := []string{"@", "launch", "--type=tab", "--tab-title=my-task", "--cwd=/tmp"} |
| 34 | if !slices.Equal(launchArgs, wantLaunch) { |
| 35 | t.Errorf("launch argv = %v; want %v", launchArgs, wantLaunch) |
| 36 | } |
| 37 | wantSend := []string{"@", "send-text", "--match=id:42", " echo hi\n"} |
| 38 | if !slices.Equal(sendArgs, wantSend) { |
| 39 | t.Errorf("send argv = %v; want %v", sendArgs, wantSend) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // TestSpawnTabEnvVarsSorted verifies env vars are emitted alphabetically, |
| 44 | // each value shell-quoted, all space-separated, before the command. This |
nothing calls this directly
no test coverage detected