zenity/zenity_test.go
2021-06-18 15:10:22 +01:00

27 lines
496 B
Go

package zenity_test
import (
"errors"
"os"
"os/exec"
"runtime"
"testing"
"go.uber.org/goleak"
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
func skip(err error) (error, bool) {
if _, ok := err.(*exec.Error); ok {
// zenity/osascript/etc were not found in path
return err, true
}
if err != nil && os.Getenv("DISPLAY") == "" && !(runtime.GOOS == "windows" || runtime.GOOS == "darwin") {
// no display
return errors.New("no display"), true
}
return nil, false
}