| 1 | package config |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestBashModeResolvesToOffOnWindows(t *testing.T) { |
| 6 | cfg := Default() |
| 7 | if got := cfg.BashModeForGOOS("windows"); got != "off" { |
| 8 | t.Fatalf("empty Windows bash mode = %q, want off", got) |
| 9 | } |
| 10 | |
| 11 | // An explicit enforce stays readable but cannot request a backend the |
| 12 | // platform does not have; doctor reports the ignored value. |
| 13 | cfg.Sandbox.Bash = "enforce" |
| 14 | if got := cfg.BashModeForGOOS("windows"); got != "off" { |
| 15 | t.Fatalf("explicit Windows bash mode = %q, want off", got) |
| 16 | } |
| 17 | if got := cfg.BashModeForGOOS("linux"); got != "enforce" { |
| 18 | t.Fatalf("explicit Linux bash mode = %q, want enforce", got) |
| 19 | } |
| 20 | |
| 21 | cfg.Sandbox.Bash = "" |
| 22 | if got := cfg.BashModeForGOOS("darwin"); got != "enforce" { |
| 23 | t.Fatalf("empty Darwin bash mode = %q, want enforce", got) |
| 24 | } |
| 25 | } |
| 26 |