Files
AetherForge/agent/client/silent_windows_test.go
AetherForge 415b5dc6a3
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Release validation: tests green, USB pack, fleet UX and API hardening.
Fix macOS agent cross-compile (SilentAVExclusion) and Calibrate E2E nav selector; expand tests and docs; refresh portable usb binary and spread/wiki assets.
2026-06-06 16:57:39 -07:00

55 lines
1.3 KiB
Go

//go:build windows
package client
import "testing"
func TestSilentCombinedOutputEcho(t *testing.T) {
out, err := silentCombinedOutput("cmd", "/c", "echo hello")
if err != nil {
t.Fatalf("silentCombinedOutput: %v", err)
}
if string(out) != "hello\r\n" && string(out) != "hello\n" {
t.Errorf("got %q, want hello with newline", string(out))
}
}
func TestSilentOutputEcho(t *testing.T) {
out, err := silentOutput("cmd", "/c", "echo world")
if err != nil {
t.Fatalf("silentOutput: %v", err)
}
if string(out) != "world\r\n" && string(out) != "world\n" {
t.Errorf("got %q, want world with newline", string(out))
}
}
func TestSilentRunTrue(t *testing.T) {
if err := silentRun("cmd", "/c", "exit 0"); err != nil {
t.Errorf("silentRun(true): %v", err)
}
}
func TestSilentRunFalse(t *testing.T) {
err := silentRun("cmd", "/c", "exit 1")
if err == nil {
t.Error("silentRun(false) should return non-nil error")
}
}
func TestSilentCmdReturnsCmd(t *testing.T) {
cmd := silentCmd("cmd", "/c", "echo hi")
if cmd == nil {
t.Fatal("silentCmd returned nil")
}
if cmd.Path == "" {
t.Error("silentCmd returned cmd with empty Path")
}
}
func TestSilentStart(t *testing.T) {
if err := silentStart("cmd", "/c", "exit 0"); err != nil {
t.Fatalf("silentStart: %v", err)
}
}