23 lines
778 B
Go
23 lines
778 B
Go
package runtime
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestManagedExecutableArgsWrapWindowsPluginScripts(t *testing.T) {
|
|
got := managedExecutableArgs("windows", []string{`C:\run workspace\bin\scum-start.cmd`, "--mode", "safe mode"})
|
|
want := []string{"cmd.exe", "/d", "/c", "call", `C:\run workspace\bin\scum-start.cmd`, "--mode", "safe mode"}
|
|
if !reflect.DeepEqual(got, want) {
|
|
t.Fatalf("unexpected Windows script command: got=%q want=%q", got, want)
|
|
}
|
|
}
|
|
|
|
func TestManagedExecutableArgsKeepsDirectExecutables(t *testing.T) {
|
|
input := []string{"C:\\run\\bin\\server.exe", "--port", "7779"}
|
|
got := managedExecutableArgs("windows", input)
|
|
if !reflect.DeepEqual(got, input) {
|
|
t.Fatalf("direct executable was unexpectedly shell wrapped: got=%q want=%q", got, input)
|
|
}
|
|
}
|