golang/go

testing: document rules for using TB

Open

#41,269 创建于 2020年9月8日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)Go (19,008 fork)batch import
DocumentationNeedsInvestigationhelp wanted

仓库指标

Star
 (133,883 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.

贡献者指南