tg.grepStderr("not an importable package", "did not detect import main")
}
-func TestCoveragePattern(t *testing.T) {
- skipIfGccgo(t, "gccgo has no cover tool")
- tooSlow(t)
- tg := testgo(t)
- defer tg.cleanup()
- tg.parallel()
- tg.makeTempdir()
- tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
-
- // If coverpkg=sleepy... expands by package loading
- // (as opposed to pattern matching on deps)
- // then it will try to load sleepybad, which does not compile,
- // and the test command will fail.
- tg.run("test", "-coverprofile="+tg.path("cover.out"), "-coverpkg=sleepy...", "-run=^$", "sleepy1")
-}
-
func TestCoverageErrorLine(t *testing.T) {
skipIfGccgo(t, "gccgo has no cover tool")
tooSlow(t)
--- /dev/null
+[gccgo] skip
+
+# If coverpkg=sleepy... expands by package loading
+# (as opposed to pattern matching on deps)
+# then it will try to load sleepybad, which does not compile,
+# and the test command will fail.
+! go list sleepy...
+go test -c -n -coverprofile=$TMPDIR/cover.out -coverpkg=sleepy... -run=^$ sleepy1
+
+-- sleepy1/p_test.go --
+package p
+
+import (
+ "testing"
+ "time"
+)
+
+func Test1(t *testing.T) {
+ time.Sleep(200 * time.Millisecond)
+}
+-- sleepy2/p_test.go --
+package p
+
+import (
+ "testing"
+ "time"
+)
+
+func Test1(t *testing.T) {
+ time.Sleep(200 * time.Millisecond)
+}
+-- sleepybad/p.go --
+package p
+
+import ^
+
+var _ = io.DoesNotExist