blob: 4f3c9ca2f270143dfd40fea5760921793a859766 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
[short] skip
go test -cover ./pkg1 ./pkg2 ./pkg3 ./pkg4
stdout 'pkg1 \[no test files\]'
stdout 'pkg2 \S+ coverage: 0.0% of statements \[no tests to run\]'
stdout 'pkg3 \S+ coverage: 100.0% of statements'
stdout 'pkg4 \S+ coverage: \[no statements\]'
-- go.mod --
module m
go 1.16
-- pkg1/a.go --
package pkg1
import "fmt"
func F() {
fmt.Println("pkg1")
}
-- pkg2/a.go --
package pkg2
import "fmt"
func F() {
fmt.Println("pkg2")
}
-- pkg2/a_test.go --
package pkg2
-- pkg3/a.go --
package pkg3
import "fmt"
func F() {
fmt.Println("pkg3")
}
-- pkg3/a_test.go --
package pkg3
import "testing"
func TestF(t *testing.T) {
F()
}
-- pkg4/a.go --
package pkg4
type T struct {
X bool
}
-- pkg4/a_test.go --
package pkg4
import (
"testing"
)
func TestT(t *testing.T) {
_ = T{}
}
|