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

@ -64,12 +64,11 @@ func TestState(t *testing.T) {
for _, subtest := range test.Subtests() {
subtest := subtest
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
name := name + "/" + key
t.Run(key+"/trie", func(t *testing.T) {
withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error {
_, _, err := test.Run(subtest, vmconfig, false)
return st.checkFailure(t, name+"/trie", err)
return st.checkFailure(t, err)
})
})
t.Run(key+"/snap", func(t *testing.T) {
@ -78,7 +77,7 @@ func TestState(t *testing.T) {
if _, err := snaps.Journal(statedb.IntermediateRoot(false)); err != nil {
return err
}
return st.checkFailure(t, name+"/snap", err)
return st.checkFailure(t, err)
})
})
}
@ -117,6 +116,6 @@ func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
} else {
t.Log("EVM operation log:\n" + buf.String())
}
//t.Logf("EVM output: 0x%x", tracer.Output())
//t.Logf("EVM error: %v", tracer.Error())
// t.Logf("EVM output: 0x%x", tracer.Output())
// t.Logf("EVM error: %v", tracer.Error())
}