...

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

Documentation: cmd/go/testdata/script

     1
     2[short] skip
     3
     4# collect coverage profile in text format
     5go test -coverprofile=blah.prof prog.go prog_test.go
     6
     7# should not contain cmd-line pseudo-import-path
     8grep prog.go blah.prof
     9grep $PWD blah.prof
    10! grep command-line-arguments blah.prof
    11
    12-- prog.go --
    13package main
    14
    15func Mumble(x int) int {
    16	if x < 0 {
    17		return -x
    18	}
    19	return 42
    20}
    21
    22func Grumble(y int) int {
    23	return -y
    24}
    25
    26func main() {
    27}
    28
    29-- prog_test.go --
    30package main
    31
    32import (
    33	"testing"
    34)
    35
    36func TestMumble(t *testing.T) {
    37	if x := Mumble(10); x != 42 {
    38		t.Errorf("Mumble(%d): got %d want %d", 10, x, 42)
    39	}
    40}

View as plain text