tests: get test name from testing.T (#22941)

There were 2 TODOs about that fix after Golang 1.8 release.
It's here for 3 years already, so now should be the right time.
This commit is contained in:
Eugene Lepeico
2021-05-25 23:47:14 +03:00
committed by GitHub
parent 750115ff39
commit 6c7d6cf886
7 changed files with 16 additions and 19 deletions

View File

@ -167,10 +167,9 @@ func (tm *testMatcher) findSkip(name string) (reason string, skipload bool) {
}
// findConfig returns the chain config matching defined patterns.
func (tm *testMatcher) findConfig(name string) *params.ChainConfig {
// TODO(fjl): name can be derived from testing.T when min Go version is 1.8
func (tm *testMatcher) findConfig(t *testing.T) *params.ChainConfig {
for _, m := range tm.configpat {
if m.p.MatchString(name) {
if m.p.MatchString(t.Name()) {
return &m.config
}
}
@ -178,11 +177,10 @@ func (tm *testMatcher) findConfig(name string) *params.ChainConfig {
}
// checkFailure checks whether a failure is expected.
func (tm *testMatcher) checkFailure(t *testing.T, name string, err error) error {
// TODO(fjl): name can be derived from t when min Go version is 1.8
func (tm *testMatcher) checkFailure(t *testing.T, err error) error {
failReason := ""
for _, m := range tm.failpat {
if m.p.MatchString(name) {
if m.p.MatchString(t.Name()) {
failReason = m.reason
break
}