(t *T, fn func(t *T))
| 480 | } |
| 481 | |
| 482 | func tRunner(t *T, fn func(t *T)) { |
| 483 | defer func() { |
| 484 | t.runCleanup() |
| 485 | }() |
| 486 | |
| 487 | // Run the test. |
| 488 | t.start = time.Now() |
| 489 | fn(t) |
| 490 | t.duration += time.Since(t.start) // TODO: capture cleanup time, too. |
| 491 | |
| 492 | t.report() // Report after all subtests have finished. |
| 493 | if t.parent != nil && !t.hasSub { |
| 494 | t.setRan() |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | // Run runs f as a subtest of t called name. It waits until the subtest is finished |
| 499 | // and returns whether the subtest succeeded. |