Go 20 lines
//go:build !windows
package queue
import "testing"
func TestProcessAlive_Guards(t *testing.T) {
if processAlive(0) {
t.Error("processAlive(0) = true, want false (pid<=0 guard)")
}
if processAlive(-1) {
t.Error("processAlive(-1) = true, want false (pid<=0 guard)")
}
// PID 1 (init/launchd) always exists. As non-root the kill(0) probe
// returns EPERM (still alive); as root it returns nil — both → true.
if !processAlive(1) {
t.Error("processAlive(1) = false, want true (pid 1 always exists)")
}
}