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

     1  [short] skip
     2  
     3  # Test
     4  go test -list=Test
     5  stdout TestSimple
     6  
     7  # Benchmark
     8  go test -list=Benchmark
     9  stdout BenchmarkSimple
    10  
    11  # Examples
    12  go test -list=Example
    13  stdout ExampleSimple
    14  stdout ExampleWithEmptyOutput
    15  
    16  -- go.mod --
    17  module m
    18  
    19  go 1.16
    20  -- bench_test.go --
    21  package testlist
    22  
    23  import (
    24  	"fmt"
    25  	"testing"
    26  )
    27  
    28  func BenchmarkSimplefunc(b *testing.B) {
    29  	b.StopTimer()
    30  	b.StartTimer()
    31  	for i := 0; i < b.N; i++ {
    32  		_ = fmt.Sprint("Test for bench")
    33  	}
    34  }
    35  -- example_test.go --
    36  package testlist
    37  
    38  import (
    39  	"fmt"
    40  )
    41  
    42  func ExampleSimple() {
    43  	fmt.Println("Test with Output.")
    44  
    45  	// Output: Test with Output.
    46  }
    47  
    48  func ExampleWithEmptyOutput() {
    49  	fmt.Println("")
    50  
    51  	// Output:
    52  }
    53  
    54  func ExampleNoOutput() {
    55  	_ = fmt.Sprint("Test with no output")
    56  }
    57  -- test_test.go --
    58  package testlist
    59  
    60  import (
    61  	"fmt"
    62  	"testing"
    63  )
    64  
    65  func TestSimple(t *testing.T) {
    66  	_ = fmt.Sprint("Test simple")
    67  }
    68  

View as plain text