(t *testing.T)
| 91 | } |
| 92 | |
| 93 | func TestStoppedTimer(t *testing.T) { |
| 94 | timer := NewStoppedTimer() |
| 95 | if !timer.when.IsZero() { |
| 96 | t.Errorf("invalid stopped timer when value") |
| 97 | } |
| 98 | |
| 99 | start := time.Now() |
| 100 | wasActive := timer.Reset(time.Second) |
| 101 | if wasActive { |
| 102 | t.Errorf("stopped timer: was active is true") |
| 103 | } |
| 104 | |
| 105 | <-timer.C |
| 106 | if int(time.Since(start).Seconds()) != 1 { |
| 107 | t.Errorf("took ~%v seconds, should be ~1 seconds\n", int(time.Since(start).Seconds())) |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | func TestStop(t *testing.T) { |
| 112 | timer := NewTimer(time.Second) |
nothing calls this directly
no test coverage detected
searching dependent graphs…