Skip to content

Commit

Permalink
fragments: Fix typo in t.Cleanup() (#339)
Browse files Browse the repository at this point in the history
While it sounds funky, `t.Pararallel()` isn't an existing function.
  • Loading branch information
To1ne authored Sep 6, 2023
1 parent 3074237 commit 9c9c26f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ Stopping for a moment to think, it makes sense. In order to known which tests ca

In cases where `t.Parallel` is used in subtests, the top-level test function is allowed to finish while subtests are still paused, so its `defer` statements can run before subtests get a chance to finish. This behavior is surprisingly and could easily leading to bugs, which is why the tparallel lint was born.

The fix is `t.Cleanup`. Like `defer`, `t.Cleanup` also guarantees LIFO order, but unlike `defer`, Go's test framework is aware of it, so even with pauses caused by `t.Pararallel`, it behaves as expected.
The fix is `t.Cleanup`. Like `defer`, `t.Cleanup` also guarantees LIFO order, but unlike `defer`, Go's test framework is aware of it, so even with pauses caused by `t.Parallel`, it behaves as expected.

0 comments on commit 9c9c26f

Please sign in to comment.