VerifyNone marks the given TestingT as failed if any extra goroutines are found by Find. This is a helper method to make it easier to integrate in tests by doing: defer VerifyNone(t) VerifyNone is currently incompatible with t.Parallel because it cannot associate specific goroutines with specific
(t TestingT, options ...Option)
| 89 | // If you need to run tests in parallel, use [VerifyTestMain] instead, |
| 90 | // which will verify that no leaking goroutines exist after ALL tests finish. |
| 91 | func VerifyNone(t TestingT, options ...Option) { |
| 92 | opts := buildOpts(options...) |
| 93 | var cleanup func(int) |
| 94 | cleanup, opts.cleanup = opts.cleanup, nil |
| 95 | |
| 96 | if h, ok := t.(testHelper); ok { |
| 97 | // Mark this function as a test helper, if available. |
| 98 | h.Helper() |
| 99 | } |
| 100 | |
| 101 | if err := Find(opts); err != nil { |
| 102 | t.Error(err) |
| 103 | } |
| 104 | |
| 105 | if cleanup != nil { |
| 106 | cleanup(0) |
| 107 | } |
| 108 | } |
searching dependent graphs…