File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,17 @@ type RunnerSuite struct {
16
16
CommonSuite
17
17
}
18
18
19
+ // TestDefaultTimer is just a smoke test to make sure the defaultTimer
20
+ // operates basically as intended.
21
+ func (suite * RunnerSuite ) TestDefaultTimer () {
22
+ ch , stop := defaultTimer (100 * time .Millisecond )
23
+ suite .NotNil (ch )
24
+ suite .Require ().NotNil (stop )
25
+
26
+ stop ()
27
+ stop () // idempotent
28
+ }
29
+
19
30
func (suite * RunnerSuite ) testRunNoRetries () {
20
31
var (
21
32
testCtx , _ = suite .testCtx ()
@@ -176,6 +187,21 @@ func (suite *RunnerSuite) TestRun() {
176
187
suite .Run ("WithRetriesAndCanceled" , suite .testRunWithRetriesAndCanceled )
177
188
}
178
189
190
+ func (suite * RunnerSuite ) TestOptionError () {
191
+ var (
192
+ expectedErr = errors .New ("expected" )
193
+ runner , actualErr = NewRunner [int ](
194
+ runnerOptionFunc [int ](func (r * runner [int ]) error {
195
+ suite .NotNil (r )
196
+ return expectedErr
197
+ }),
198
+ )
199
+ )
200
+
201
+ suite .Nil (runner )
202
+ suite .Same (expectedErr , actualErr )
203
+ }
204
+
179
205
func TestRunner (t * testing.T ) {
180
206
suite .Run (t , new (RunnerSuite ))
181
207
}
You can’t perform that action at this time.
0 commit comments