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

     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  
     9  go test -short -cover cgocover3
    10  stdout  'coverage:.*[1-9][0-9.]+%'
    11  ! stderr '[^0-9]0\.0%'
    12  
    13  -- go.mod --
    14  module cgocover3
    15  
    16  go 1.16
    17  -- p.go --
    18  package p
    19  
    20  /*
    21  void
    22  f(void)
    23  {
    24  }
    25  */
    26  import "C"
    27  
    28  var b bool
    29  
    30  func F() {
    31  	if b {
    32  		for {
    33  		}
    34  	}
    35  	C.f()
    36  }
    37  -- p_test.go --
    38  package p
    39  -- x_test.go --
    40  package p_test
    41  
    42  import (
    43  	. "cgocover3"
    44  	"testing"
    45  )
    46  
    47  func TestF(t *testing.T) {
    48  	F()
    49  }
    50  

View as plain text