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:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user