testing: add Attr

Add a new Attr method to testing.TB that emits a test attribute.
An attribute is an arbitrary key/value pair.

Fixes #43936

Change-Id: I7ef299efae41f2cf39f2dc61ad4cdd4c3975cdb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/662437
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
This commit is contained in:
Damien Neil 2025-04-02 17:37:34 -07:00 committed by Gopher Robot
parent 763963505e
commit 3cc8b532f9
7 changed files with 117 additions and 0 deletions

View file

@ -0,0 +1,10 @@
The new methods [T.Attr], [B.Attr], and [F.Attr] emit an
attribute to the test log. An attribute is an arbitrary
key and value associated with a test.
For example, in a test named `TestAttr`,
`t.Attr("key", "value")` emits:
```
=== ATTR TestAttr key value
```