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

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

View as plain text