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
8 go test -short -cover cgocover4
9 stdout 'coverage:.*[1-9][0-9.]+%'
10 ! stderr '[^0-9]0\.0%'
11
12 -- go.mod --
13 module cgocover4
14
15 go 1.16
16 -- notcgo.go --
17 package p
18 -- p.go --
19 package p
20
21 /*
22 void
23 f(void)
24 {
25 }
26 */
27 import "C"
28
29 var b bool
30
31 func F() {
32 if b {
33 for {
34 }
35 }
36 C.f()
37 }
38 -- x_test.go --
39 package p_test
40
41 import (
42 . "cgocover4"
43 "testing"
44 )
45
46 func TestF(t *testing.T) {
47 F()
48 }
49
View as plain text