Improve test coverage.
This commit is contained in:
parent
3274dd7bdb
commit
ab2a08c75a
1 changed files with 31 additions and 0 deletions
31
internal/zencmd/window_unix_test.go
Normal file
31
internal/zencmd/window_unix_test.go
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
//go:build !windows && !darwin
|
||||||
|
|
||||||
|
package zencmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test_getPidToPpidMap(t *testing.T) {
|
||||||
|
got, err := getPidToPpidMap()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("getPidToPpidMap() error = %v", err)
|
||||||
|
}
|
||||||
|
if ppid := got[os.Getpid()]; ppid != os.Getppid() {
|
||||||
|
t.Errorf("getPidToPpidMap()[%d] = %d; want %d", os.Getpid(), ppid, os.Getppid())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Test_getPidToWindowMap(t *testing.T) {
|
||||||
|
got, err := getPidToWindowMap()
|
||||||
|
if err != nil {
|
||||||
|
if os.Getenv("DISPLAY") == "" {
|
||||||
|
t.Skip("skipping:", err)
|
||||||
|
}
|
||||||
|
t.Fatalf("getPidToWindowMap() error = %v", err)
|
||||||
|
}
|
||||||
|
if len(got) == 0 {
|
||||||
|
t.Errorf("getPidToWindowMap() %v", got)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue