| 🛟 Updated. 28d5985 k33g 12h ago | 1 | //go:build linux || darwin |
| 2 | |
| 3 | package terminal |
| 4 | |
| 5 | import "testing" |
| 6 | |
| 7 | func TestShellOrDefault(t *testing.T) { |
| 8 | if got := shellOrDefault("/bin/zsh"); got != "/bin/zsh" { |
| 9 | t.Errorf("shellOrDefault() = %q, want the shell asked for", got) |
| 10 | } |
| 11 | |
| 12 | t.Setenv("SHELL", "/bin/ksh") |
| 13 | if got := shellOrDefault(""); got != "/bin/ksh" { |
| 14 | t.Errorf("shellOrDefault() = %q, want the user's own shell", got) |
| 15 | } |
| 16 | |
| 17 | t.Setenv("SHELL", "") |
| 18 | if got := shellOrDefault(""); got != "/bin/sh" { |
| 19 | t.Errorf("shellOrDefault() = %q, want the fallback", got) |
| 20 | } |
| 21 | } |