返回 DeepSeek-Reasonix
batch_command_windows_test.go
根目录 / internal / hook / batch_command_windows_test.go
1 //go:build windows
2
3 package hook
4
5 import (
6 "context"
7 "testing"
8 )
9
10 func TestNewWindowsBatchCommandPreservesBackgroundPolicy(t *testing.T) {
11 const commandLine = `cmd.exe /d /s /c ""C:\Program Files\tool.cmd" run"`
12 cmd, ok := newWindowsBatchCommand(context.Background(), commandLine, true)
13 if !ok || cmd == nil {
14 t.Fatal("expected a Windows batch command")
15 }
16 if cmd.SysProcAttr == nil || !cmd.SysProcAttr.HideWindow {
17 t.Fatal("batch command lost the hidden-window policy")
18 }
19 if cmd.SysProcAttr.CmdLine != commandLine {
20 t.Fatalf("CmdLine = %q, want %q", cmd.SysProcAttr.CmdLine, commandLine)
21 }
22 }
23
23 lines GO