1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-18 14:47:03 +00:00

testlib: Add tests for testlib.WaitFor

This commit is contained in:
Alberto Bertogli
2020-03-21 23:56:31 +00:00
parent fdae72f275
commit 29512f7e4f

View File

@@ -4,6 +4,7 @@ import (
"io/ioutil"
"os"
"testing"
"time"
)
func TestBasic(t *testing.T) {
@@ -83,3 +84,15 @@ func TestGetFreePort(t *testing.T) {
t.Errorf("failed to get free port")
}
}
func TestWaitFor(t *testing.T) {
ok := WaitFor(func() bool { return true }, 20*time.Millisecond)
if !ok {
t.Errorf("WaitFor(true) timed out")
}
ok = WaitFor(func() bool { return false }, 20*time.Millisecond)
if ok {
t.Errorf("WaitFor(false) worked")
}
}