You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To reproduce, create the following three files:
testit.go
package testit
extern_test.go:
package testit_test
import (
"code.google.com/p/rog-go/testit"
)
func init() {
testit.Register()
unused
}
intern_test.go:
package testit
import "testing"
var registered bool
func Register() {
registered = true
}
func TestPackage(t *testing.T) {
if !registered {
t.Fatal("registry never called")
}
}
Running the tests gives the error "registry never called",
indicating that the code in extern_test.go is never run.
Moreover, it's not even compiled - there's no error from
the unused variable.
While it may look contrived, the above configuration mirrors the way
that tests are registered with the popular gocheck testing
package - tests that were previously run correctly may now
be silently skipped.
I have verified that this is a regression since Go 1.2.2.
FWIW, there is an easy workaround (define TestPackage in the external
test file) but it might be better to avoid the regression.
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: