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