...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=off
     2
     3# Coverage analysis should use 'set' mode by default,
     4# and should merge coverage profiles correctly.
     5
     6[short] skip
     7[compiler:gccgo] skip # gccgo has no cover tool
     8
     9go test -short -cover encoding/binary errors -coverprofile=$WORK/cover.out
    10! stderr '[^0-9]0\.0%'
    11! stdout '[^0-9]0\.0%'
    12
    13grep -count=1 '^mode: set$' $WORK/cover.out
    14grep 'errors\.go' $WORK/cover.out
    15grep 'binary\.go' $WORK/cover.out
    16
    17[!race] stop
    18
    19go test -short -race -cover encoding/binary errors -coverprofile=$WORK/cover.out
    20! stderr '[^0-9]0\.0%'
    21! stdout '[^0-9]0\.0%'
    22
    23grep -count=1 '^mode: atomic$' $WORK/cover.out
    24grep 'errors\.go' $WORK/cover.out
    25grep 'binary\.go' $WORK/cover.out

View as plain text