1 # This test checks that -coverpkg=all can be used
2 # when the package pattern includes packages
3 # which only have tests.
4 # Verifies golang.org/issue/27333, golang.org/issue/43242.
5
6 [short] skip
7 cd $GOPATH/src/example.com/cov
8
9 env GO111MODULE=on
10 go test -coverpkg=all ./...
11
12 env GO111MODULE=off
13 go test -coverpkg=all ./...
14
15 -- $GOPATH/src/example.com/cov/go.mod --
16 module example.com/cov
17
18 -- $GOPATH/src/example.com/cov/notest/notest.go --
19 package notest
20
21 func Foo() {}
22
23 -- $GOPATH/src/example.com/cov/onlytest/onlytest_test.go --
24 package onlytest_test
25
26 import (
27 "testing"
28
29 "example.com/cov/notest"
30 )
31
32 func TestFoo(t *testing.T) {
33 notest.Foo()
34 }
35
36 -- $GOPATH/src/example.com/cov/withtest/withtest.go --
37 package withtest
38
39 func Bar() {}
40
41 -- $GOPATH/src/example.com/cov/withtest/withtest_test.go --
42 package withtest
43
44 import "testing"
45
46 func TestBar(t *testing.T) {
47 Bar()
48 }
49
View as plain text