github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/cover_cgo_extra_file.txt (about) 1 [!cgo] skip 2 [gccgo] skip # gccgo has no cover tool 3 4 # Test coverage on cgo code. This test case includes an 5 # extra empty non-cgo file in the package being checked. 6 7 go test -short -cover cgocover4 8 stdout 'coverage:.*[1-9][0-9.]+%' 9 ! stderr '[^0-9]0\.0%' 10 11 -- cgocover4/notcgo.go -- 12 package p 13 -- cgocover4/p.go -- 14 package p 15 16 /* 17 void 18 f(void) 19 { 20 } 21 */ 22 import "C" 23 24 var b bool 25 26 func F() { 27 if b { 28 for { 29 } 30 } 31 C.f() 32 } 33 -- cgocover4/x_test.go -- 34 package p_test 35 36 import ( 37 . "cgocover4" 38 "testing" 39 ) 40 41 func TestF(t *testing.T) { 42 F() 43 }