...

Text file src/cmd/go/testdata/script/cover_pkgall_imports.txt

Documentation: cmd/go/testdata/script

     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
     7cd $GOPATH/src/example.com/cov
     8
     9env GO111MODULE=on
    10go test -coverpkg=all ./...
    11
    12env GO111MODULE=off
    13go test -coverpkg=all ./...
    14
    15-- $GOPATH/src/example.com/cov/go.mod --
    16module example.com/cov
    17
    18-- $GOPATH/src/example.com/cov/notest/notest.go --
    19package notest
    20
    21func Foo() {}
    22
    23-- $GOPATH/src/example.com/cov/onlytest/onlytest_test.go --
    24package onlytest_test
    25
    26import (
    27	"testing"
    28
    29	"example.com/cov/notest"
    30)
    31
    32func TestFoo(t *testing.T) {
    33	notest.Foo()
    34}
    35
    36-- $GOPATH/src/example.com/cov/withtest/withtest.go --
    37package withtest
    38
    39func Bar() {}
    40
    41-- $GOPATH/src/example.com/cov/withtest/withtest_test.go --
    42package withtest
    43
    44import "testing"
    45
    46func TestBar(t *testing.T) {
    47	Bar()
    48}

View as plain text