| 1 |
# This test checks that multiple main packages can be tested |
| 2 |
# with -coverpkg=all without duplicate symbol errors. |
| 3 |
# Verifies golang.org/issue/30374, golang.org/issue/34114. |
| 4 |
|
| 5 |
[short] skip |
| 6 |
cd $GOPATH/src/example.com/cov |
| 7 |
|
| 8 |
env GO111MODULE=on |
| 9 |
go test -coverpkg=all ./... |
| 10 |
|
| 11 |
env GO111MODULE=off |
| 12 |
go test -coverpkg=all ./... |
| 13 |
|
| 14 |
-- $GOPATH/src/example.com/cov/go.mod -- |
| 15 |
module example.com/cov |
| 16 |
|
| 17 |
-- $GOPATH/src/example.com/cov/mainonly/mainonly.go -- |
| 18 |
package main |
| 19 |
|
| 20 |
func main() {} |
| 21 |
|
| 22 |
-- $GOPATH/src/example.com/cov/mainwithtest/mainwithtest.go -- |
| 23 |
package main |
| 24 |
|
| 25 |
func main() {} |
| 26 |
|
| 27 |
func Foo() {} |
| 28 |
|
| 29 |
-- $GOPATH/src/example.com/cov/mainwithtest/mainwithtest_test.go -- |
| 30 |
package main |
| 31 |
|
| 32 |
import "testing" |
| 33 |
|
| 34 |
func TestFoo(t *testing.T) { |
| 35 |
Foo() |
| 36 |
} |
| 37 |
|
| 38 |
-- $GOPATH/src/example.com/cov/xtest/x.go -- |
| 39 |
package x |
| 40 |
|
| 41 |
-- $GOPATH/src/example.com/cov/xtest/x_test.go -- |
| 42 |
package x_test |
| 43 |
|
| 44 |
import "testing" |
| 45 |
|
| 46 |
func TestX(t *testing.T) {} |