Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fragments: Fix typo in t.Cleanup() #339

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fragments: Fix typo in t.Cleanup()
While it sounds funky, `t.Pararallel()` isn't an existing function.
  • Loading branch information
To1ne authored Sep 6, 2023
commit 74b653d2b8ddad830c75de324dbc3f10a6034484
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.