github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/cover_cgo.txt (about)

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