Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/go/testdata/script

     1  [gccgo] skip # gccgo does not have standard packages
     2  [short] skip
     3  
     4  env GOCACHE=$WORK/tmp
     5  
     6  # Run go test -json on errors m/empty/pkg and m/skipper
     7  # It would be nice to test that the output is interlaced
     8  # but it seems to be impossible to do that in a short test
     9  # that isn't also flaky. Just check that we get JSON output.
    10  go test -json -short -v errors m/empty/pkg m/skipper
    11  
    12  # Check errors for run action
    13  stdout '"Package":"errors"'
    14  stdout '"Action":"run","Package":"errors"'
    15  
    16  # Check m/empty/pkg for output and skip actions
    17  stdout '"Action":"output","Package":"m/empty/pkg","Output":".*no test files'
    18  stdout '"Action":"skip","Package":"m/empty/pkg"'
    19  
    20  # Check skipper for output and skip actions
    21  stdout '"Action":"output","Package":"m/skipper","Test":"Test","Output":"--- SKIP:'
    22  stdout '"Action":"skip","Package":"m/skipper","Test":"Test"'
    23  
    24  # Run go test -json on errors and check it's cached
    25  go test -json -short -v errors
    26  stdout '"Action":"output","Package":"errors","Output":".*\(cached\)'
    27  
    28  go test -json -bench=NONE -short -v errors
    29  stdout '"Package":"errors"'
    30  stdout '"Action":"run"'
    31  
    32  # Test running test2json
    33  go test -o $WORK/tmp/errors.test$GOEXE -c errors
    34  go tool test2json -p errors $WORK/tmp/errors.test$GOEXE -test.v -test.short
    35  stdout '"Package":"errors"'
    36  stdout '"Action":"run"'
    37  stdout '\{"Action":"pass","Package":"errors"\}'
    38  
    39  -- go.mod --
    40  module m
    41  
    42  go 1.16
    43  -- skipper/skip_test.go --
    44  package skipper
    45  
    46  import "testing"
    47  
    48  func Test(t *testing.T) {
    49  	t.Skip("skipping")
    50  }
    51  -- empty/pkg/pkg.go --
    52  package p
    53  -- empty/pkgtest/pkg.go --
    54  package p
    55  -- empty/pkgtest/test_test.go --
    56  package p
    57  -- empty/pkgtestxtest/pkg.go --
    58  package p
    59  -- empty/pkgtestxtest/test_test.go --
    60  package p
    61  -- empty/pkgtestxtest/xtest_test.go --
    62  package p_test
    63  -- empty/pkgxtest/pkg.go --
    64  package p
    65  -- empty/pkgxtest/xtest_test.go --
    66  package p_test
    67  -- empty/test/test_test.go --
    68  package p
    69  -- empty/testxtest/test_test.go --
    70  package p
    71  -- empty/testxtest/xtest_test.go --
    72  package p_test
    73  -- empty/xtest/xtest_test.go --
    74  package p_test
    75  

View as plain text