...

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

Documentation: cmd/go/testdata/script

     1[short] skip
     2[!cgo] skip
     3[compiler:gccgo] skip # gccgo has no cover tool
     4
     5# Test coverage on cgo code.
     6
     7go test -short -cover cgocover
     8stdout  'coverage:.*[1-9][0-9.]+%'
     9! stderr '[^0-9]0\.0%'
    10
    11-- go.mod --
    12module cgocover
    13
    14go 1.16
    15-- p.go --
    16package p
    17
    18/*
    19void
    20f(void)
    21{
    22}
    23*/
    24import "C"
    25
    26var b bool
    27
    28func F() {
    29	if b {
    30		for {
    31		}
    32	}
    33	C.f()
    34}
    35-- p_test.go --
    36package p
    37
    38import "testing"
    39
    40func TestF(t *testing.T) {
    41	F()
    42}

View as plain text