Name returns the name of the running test or benchmark.
For a func TestFoo(t *testing.T), I think it's reasonably clear that Name will be TestFoo.
However, for a sub-test like t.Run("Bar", ...), it's not clear from the documentation if Name will return TestFoo/Bar or just TestFoo.
Another open question is whether the name will be altered, just like it is when printing output. For example, t.Run("bar baz", ...) ends up printing TestFoo/bar_baz in the terminal, so if the subtest name is included in the Name method, I'm not sure which of the two I'd expect.
According to the discussion, it is clear that T.Name returns a
distinct name among all tests. However, there is no specification
of how sub-tests with the same specified test name are constructed.
This change only clarifies the uniqueness and the components of the
name without suggesting any explicit format of the returned name.
Reviewed-by: Ian Lance Taylor <email@example.com>
Reviewed-by: Emmanuel Odeke <firstname.lastname@example.org>
Run-TryBot: Ian Lance Taylor <email@example.com>
TryBot-Result: Go Bot <firstname.lastname@example.org>