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

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

View as plain text