An example of testing time durations
()
| 22 | |
| 23 | // An example of testing time durations |
| 24 | func ExampleTime() { |
| 25 | assert := assert.To(nil) |
| 26 | assert.For("1s IsAtLeast 2s").ThatDuration(time.Second * 1).IsAtLeast(time.Second * 2) |
| 27 | assert.For("3s IsAtMost 4s").ThatDuration(time.Second * 3).IsAtMost(time.Second * 4) |
| 28 | assert.For("6s IsAtLeast 5s").ThatDuration(time.Second * 6).IsAtLeast(time.Second * 5) |
| 29 | assert.For("8s IsAtMost 7s").ThatDuration(time.Second * 8).IsAtMost(time.Second * 7) |
| 30 | // Output: |
| 31 | // Error:1s IsAtLeast 2s |
| 32 | // Got 1s |
| 33 | // Expect >= 2s |
| 34 | // Error:8s IsAtMost 7s |
| 35 | // Got 8s |
| 36 | // Expect <= 7s |
| 37 | } |
nothing calls this directly
no test coverage detected