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

     1  [short] skip
     2  [compiler:gccgo] skip # gccgo has no cover tool
     3  
     4  # Test cover for a package that has an assembly function.
     5  
     6  go test -outputdir=$WORK -coverprofile=cover.out coverasm
     7  go tool cover -func=$WORK/cover.out
     8  stdout '\tg\t*100.0%' # Check g is 100% covered.
     9  ! stdout '\tf\t*[0-9]' # Check for no coverage on the assembly function
    10  
    11  -- go.mod --
    12  module coverasm
    13  
    14  go 1.16
    15  -- p.go --
    16  package p
    17  
    18  func f()
    19  
    20  func g() {
    21  	println("g")
    22  }
    23  -- p.s --
    24  // empty asm file,
    25  // so go test doesn't complain about declaration of f in p.go.
    26  -- p_test.go --
    27  package p
    28  
    29  import "testing"
    30  
    31  func Test(t *testing.T) {
    32  	g()
    33  }
    34  

View as plain text