1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
package systray import ( "syscall" "testing" ) const ( invalidPid = 345678 ) func TestPidRunning(t *testing.T) { pid := syscall.Getpid() if !pidRunning(pid) { t.Errorf("pid %v is not running", pid) } if pidRunning(invalidPid) { t.Errorf("pid %v is running", invalidPid) } }