package internal import ( "strings" "testing" ) // TestWtExeNeverReturnsBareName 锁定 wtExe 的契约:要么返回真实路径,要么返回空串, // 绝不能返回裸 "wt.exe"。 // 裸 "wt.exe" 在未安装 Windows Terminal 的机器上会让 exec.Command 启动报 // `exec: "wt.exe": executable file not found in %PATH%`(v0.2.2 的崩溃根因)。 // 空串触发 launchInWtWithTitle 的 cmd /c start 独立窗口回退。 func TestWtExeNeverReturnsBareName(t *testing.T) { got := wtExe() if got == "wt.exe" { t.Fatalf("wtExe() returned bare %q; must return full path or empty string", got) } if got != "" && !strings.HasSuffix(got, "wt.exe") { t.Fatalf("wtExe() returned unexpected path %q", got) } t.Logf("wtExe() = %q (empty ⇒ wt absent → cmd fallback)", got) }