summaryrefslogtreecommitdiff
path: root/pid_test.go
blob: 2c926417e59f86e2bf7e0f4fe92358b80de04d95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package main

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)
	}
}