clock+test: convert checks to testify asserts

This commit is contained in:
Andras Banki-Horvath 2020-05-26 22:49:19 +02:00
parent e81061bda4
commit 337d282a3f

@ -15,16 +15,11 @@ var (
func TestNow(t *testing.T) { func TestNow(t *testing.T) {
c := NewTestClock(testTime) c := NewTestClock(testTime)
now := c.Now() now := c.Now()
assert.Equal(t, testTime, now)
if now != testTime {
t.Fatalf("expected: %v, got: %v", testTime, now)
}
now = now.Add(time.Hour) now = now.Add(time.Hour)
c.SetTime(now) c.SetTime(now)
if c.Now() != now { assert.Equal(t, now, c.Now())
t.Fatalf("epected: %v, got: %v", now, c.Now())
}
} }
func TestTickAfter(t *testing.T) { func TestTickAfter(t *testing.T) {
@ -49,9 +44,7 @@ func TestTickAfter(t *testing.T) {
case <-time.After(time.Millisecond): case <-time.After(time.Millisecond):
} }
if tick != expectTick { assert.Equal(t, expectTick, tick)
t.Fatalf("expected tick: %v, ticked: %v", expectTick, tick)
}
} }
tickOrTimeOut(ticker0, true) tickOrTimeOut(ticker0, true)