Closed smallinsky closed 4 years ago
The idea is very smart, unfortunately it will not convert all cases for example following case where the getT function is called from goroutine.
func TestGetTInGoroutine(t *testing.T) { t.Run("fistTest", func(t *testing.T) { go func() { tt := getT() if tt != nil { tt.Fatal("log from goroutine") } // test will silently pass. }() }) }
This is specifically disallowed because the testing package requires that t.Fatal be called from the main testing goroutine.
Closing, sorry.
The idea is very smart, unfortunately it will not convert all cases for example following case where the getT function is called from goroutine.