...

Text file src/cmd/go/testdata/script/cover_cgo_extra_test.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. This test case has an external
     6# test that tests the code and an in-package test file with
     7# no test cases.
     8
     9go test -short -cover cgocover3
    10stdout  'coverage:.*[1-9][0-9.]+%'
    11! stderr '[^0-9]0\.0%'
    12
    13-- go.mod --
    14module cgocover3
    15
    16go 1.16
    17-- p.go --
    18package p
    19
    20/*
    21void
    22f(void)
    23{
    24}
    25*/
    26import "C"
    27
    28var b bool
    29
    30func F() {
    31	if b {
    32		for {
    33		}
    34	}
    35	C.f()
    36}
    37-- p_test.go --
    38package p
    39-- x_test.go --
    40package p_test
    41
    42import (
    43	. "cgocover3"
    44	"testing"
    45)
    46
    47func TestF(t *testing.T) {
    48	F()
    49}

View as plain text