...

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

Documentation: cmd/go/testdata/script

     1[short] skip
     2[compiler:gccgo] skip
     3
     4# Test line numbers in cover errors.
     5
     6# Get errors from a go test into stderr.txt
     7! go test coverbad
     8stderr 'p\.go:4:2' # look for error at coverbad/p.go:4
     9[cgo] stderr 'p1\.go:6:2' # look for error at coverbad/p.go:6
    10! stderr $WORK # make sure temporary directory isn't in error
    11
    12cp stderr $WORK/stderr.txt
    13
    14# Get errors from coverage into stderr2.txt
    15! go test -cover coverbad
    16cp stderr $WORK/stderr2.txt
    17
    18wait # for go run above
    19
    20cmp $WORK/stderr.txt $WORK/stderr2.txt
    21
    22-- go.mod --
    23module coverbad
    24
    25go 1.16
    26-- p.go --
    27package p
    28
    29func f() {
    30	g()
    31}
    32-- p1.go --
    33package p
    34
    35import "C"
    36
    37func h() {
    38	j()
    39}
    40-- p_test.go --
    41package p
    42
    43import "testing"
    44
    45func Test(t *testing.T) {}

View as plain text