author | Alberto Bertogli
<albertito@blitiri.com.ar> 2020-03-21 23:56:31 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2020-03-21 23:56:31 UTC |
parent | fdae72f275c34ecce2a30e641d55e9e76e857863 |
internal/testlib/testlib_test.go | +13 | -0 |
diff --git a/internal/testlib/testlib_test.go b/internal/testlib/testlib_test.go index 10c90eb..b2da661 100644 --- a/internal/testlib/testlib_test.go +++ b/internal/testlib/testlib_test.go @@ -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") + } +}