(t *testing.T)
| 52 | } |
| 53 | |
| 54 | func TestResetTimer_AfterFired(t *testing.T) { |
| 55 | timer := time.NewTimer(time.Nanosecond) |
| 56 | // Wait for it to fire. |
| 57 | time.Sleep(time.Millisecond) |
| 58 | <-timer.C |
| 59 | |
| 60 | // Reset after consuming the fired event. |
| 61 | ResetTimer(timer, time.Nanosecond) |
| 62 | |
| 63 | select { |
| 64 | case <-timer.C: |
| 65 | // Expected. |
| 66 | case <-time.After(100 * time.Millisecond): |
| 67 | t.Fatal("expected timer to fire after reset") |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | func TestResetTimer_MultipleTimes(t *testing.T) { |
| 72 | timer := time.NewTimer(time.Hour) |
nothing calls this directly
no test coverage detected