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

Add recommendation on using table tests for single case tests. #167

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions style.md
Original file line number Diff line number Diff line change
Expand Up @@ -3691,6 +3691,10 @@ for _, tt := range tests {
}
```

Prefer table-test (structured) style when possible even for a single test case -
this style makes the tests easier to extend in the future as the the “arguments under
test” are clearly specified via `have` and `want`.

Parallel tests, like some specialized loops (for example, those that spawn
goroutines or capture references as part of the loop body),
must take care to explicitly assign loop variables within the loop's scope to
Expand Down