Skip to content

testing: document rules for using TB #41269

Open
@dsymonds

Description

@dsymonds

There's rules about what a TestFoo may do with the *testing.T it is given. Some are documented (e.g. https://golang.org/pkg/testing/#T puts restrictions on invoking Fatalf and friends), but some are not (e.g. Logf and probably most other methods should not be called after TestFoo returns). Same applies to *testing.B and any future such values/types.

I came across this while trying to diagnose a problem that seems to be due to #40908, but realised I couldn't find the rules written down anywhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.help wanted

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions