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

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

View as plain text