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

     1  [short] skip
     2  [gccgo] skip
     3  
     4  # coverdep2/p1's xtest imports coverdep2/p2 which imports coverdep2/p1.
     5  # Make sure that coverage on coverdep2/p2 recompiles coverdep2/p2.
     6  
     7  go test -short -cover coverdep2/p1
     8  stdout 'coverage: 100.0% of statements' # expect 100.0% coverage
     9  
    10  -- go.mod --
    11  module coverdep2
    12  
    13  go 1.16
    14  -- p1/p.go --
    15  package p1
    16  
    17  func F() int { return 1 }
    18  -- p1/p_test.go --
    19  package p1_test
    20  
    21  import (
    22  	"coverdep2/p2"
    23  	"testing"
    24  )
    25  
    26  func Test(t *testing.T) {
    27  	p2.F()
    28  }
    29  -- p2/p2.go --
    30  package p2
    31  
    32  import "coverdep2/p1"
    33  
    34  func F() {
    35  	p1.F()
    36  }
    37  

View as plain text