...
1[short] skip
2[!cgo] skip
3[compiler:gccgo] skip # gccgo has no cover tool
4
5# Test coverage on cgo code. This test case includes an
6# extra empty non-cgo file in the package being checked.
7
8go test -short -cover cgocover4
9stdout 'coverage:.*[1-9][0-9.]+%'
10! stderr '[^0-9]0\.0%'
11
12-- go.mod --
13module cgocover4
14
15go 1.16
16-- notcgo.go --
17package p
18-- p.go --
19package p
20
21/*
22void
23f(void)
24{
25}
26*/
27import "C"
28
29var b bool
30
31func F() {
32 if b {
33 for {
34 }
35 }
36 C.f()
37}
38-- x_test.go --
39package p_test
40
41import (
42 . "cgocover4"
43 "testing"
44)
45
46func TestF(t *testing.T) {
47 F()
48}
View as plain text