This commit is contained in:
npc0-hue
2026-08-26 09:56:43 +08:00
parent 2b4974b561
commit 8e02a316fa
93 changed files with 21749 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
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)
}
}