返回 DeepSeek-Reasonix
terminal_shell_config_test.go
根目录 / desktop / terminal_shell_config_test.go
1 package main
2
3 import (
4 "path/filepath"
5 "testing"
6 )
7
8 func TestTerminalCommandFromConfigIgnoresCrossKindPath(t *testing.T) {
9 dir := t.TempDir()
10 for _, tc := range []struct {
11 name string
12 prefer string
13 stale string
14 }{
15 {"PowerShell path after selecting Bash", "bash", testExecutable(t, dir, "pwsh")},
16 {"Bash path after selecting PowerShell", "powershell", testExecutable(t, dir, "bash")},
17 } {
18 t.Run(tc.name, func(t *testing.T) {
19 command, ok := terminalCommandFromConfig(tc.prefer, tc.stale)
20 if !ok {
21 t.Fatal("expected the selected shell or its normal fallback to resolve")
22 }
23 if filepath.Clean(command.path) == filepath.Clean(tc.stale) {
24 t.Fatalf("terminal reused incompatible configured path %q", command.path)
25 }
26 })
27 }
28 }
29
29 lines GO