diff --git a/myexec/cmd_test.go b/myexec/cmd_uixt_test.go similarity index 100% rename from myexec/cmd_test.go rename to myexec/cmd_uixt_test.go diff --git a/myexec/cmd_windows_test.go b/myexec/cmd_windows_test.go new file mode 100644 index 0000000..31d84d8 --- /dev/null +++ b/myexec/cmd_windows_test.go @@ -0,0 +1,21 @@ +package myexec + +import "testing" + +func TestRunShell(t *testing.T) { + exitCode, err := RunShell("echo hello world") + if err != nil { + t.Fatal(err) + } + if exitCode != 0 { + t.Fatalf("expected exit code 0, got %d", exitCode) + } + + exitCode, err = RunShell("dir /b /s; exit /b 3") + if err == nil { + t.Fatal(err) + } + if exitCode != 3 { + t.Fatalf("expected exit code 3, got %d", exitCode) + } +}