Skip to content

Commit

Permalink
Accept TB and not *testing.T in Check()
Browse files Browse the repository at this point in the history
Fixes #50
  • Loading branch information
flyingmutant committed Aug 3, 2023
1 parent 2fe187c commit f4756c7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ func assertValidRange(min int, max int) {
}
}

func checkDeadline(t *testing.T) time.Time {
if t == nil {
return time.Now().Add(maxTestTimeout) // convenience
func checkDeadline(tb tb) time.Time {
t, ok := tb.(*testing.T)
if !ok {
return time.Now().Add(maxTestTimeout)
}
d, ok := t.Deadline()
if !ok {
Expand All @@ -112,7 +113,7 @@ func shrinkDeadline(deadline time.Time) time.Time {
//
// Property is falsified in case of a panic or a call to
// [*T.Fatalf], [*T.Fatal], [*T.Errorf], [*T.Error], [*T.FailNow] or [*T.Fail].
func Check(t *testing.T, prop func(*T)) {
func Check(t TB, prop func(*T)) {
t.Helper()
checkTB(t, checkDeadline(t), prop)
}
Expand Down

0 comments on commit f4756c7

Please sign in to comment.