Files
run/runtime/managed_command_test.go
2026-08-26 09:56:43 +08:00

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)
}
}