| 1 | package boot |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "reasonix/internal/sandbox" |
| 7 | ) |
| 8 | |
| 9 | func TestResolvedShellLabelUsesBoundInterpreter(t *testing.T) { |
| 10 | for _, tc := range []struct { |
| 11 | name string |
| 12 | shell sandbox.Shell |
| 13 | configuredPath string |
| 14 | want string |
| 15 | }{ |
| 16 | {"configured path uses resolved executable", sandbox.Shell{Kind: sandbox.ShellPowerShell, Path: `C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe`}, `C:\stale\bash.exe`, `C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe`}, |
| 17 | {"auto resolution preserves cache-stable kind", sandbox.Shell{Kind: sandbox.ShellBash, Path: `/opt/homebrew/bin/bash`}, "", "bash"}, |
| 18 | {"kind fallback", sandbox.Shell{Kind: sandbox.ShellZsh}, "", "zsh"}, |
| 19 | } { |
| 20 | t.Run(tc.name, func(t *testing.T) { |
| 21 | if got := resolvedShellLabel(tc.shell, tc.configuredPath); got != tc.want { |
| 22 | t.Fatalf("shell label = %q, want %q", got, tc.want) |
| 23 | } |
| 24 | }) |
| 25 | } |
| 26 | } |
| 27 |