...

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

Documentation: cmd/go/testdata/script

     1go test -v norunexample
     2stdout 'File with non-runnable example was built.'
     3
     4-- go.mod --
     5module norunexample
     6
     7go 1.16
     8-- example_test.go --
     9package pkg_test
    10
    11import "os"
    12
    13func init() {
    14	os.Stdout.Write([]byte("File with non-runnable example was built.\n"))
    15}
    16
    17func Example_test() {
    18	// This test will not be run, it has no "Output:" comment.
    19}
    20-- test_test.go --
    21package pkg
    22
    23import (
    24	"os"
    25	"testing"
    26)
    27
    28func TestBuilt(t *testing.T) {
    29	os.Stdout.Write([]byte("A normal test was executed.\n"))
    30}

View as plain text