Skip to content
This repository has been archived by the owner on May 18, 2023. It is now read-only.

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Soref <[email protected]>
  • Loading branch information
djmitche and jsoref authored Oct 29, 2021
1 parent 37a1270 commit eb95674
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions clock.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ func (m *Mock) Now() time.Time {
return m.now
}

// Since returns time since t, using the mock clock's wall time.
// Since returns time since `t` using the mock clock's wall time.
func (m *Mock) Since(t time.Time) time.Duration {
return m.Now().Sub(t)
}

// Until returns time until t, using the mock clock's wall time.
// Until returns time until `t` using the mock clock's wall time.
func (m *Mock) Until(t time.Time) time.Duration {
return t.Sub(m.Now())
}
Expand Down
4 changes: 2 additions & 2 deletions clock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,11 @@ func TestMock_Until(t *testing.T) {

end := clock.Now().Add(500 * time.Second)
if dur := clock.Until(end); dur.Seconds() != 500 {
t.Fatalf("expected 500 to the end, actually: %v", dur.Seconds())
t.Fatalf("expected 500s duration between `clock` and `end`, actually: %v", dur.Seconds())
}
clock.Add(100 * time.Second)
if dur := clock.Until(end); dur.Seconds() != 400 {
t.Fatalf("expected 400 to the end, actually: %v", dur.Seconds())
t.Fatalf("expected 400s duration between `clock` and `end`, actually: %v", dur.Seconds())
}
}

Expand Down

0 comments on commit eb95674

Please sign in to comment.