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 Example_simple
14 stdout Example_withEmptyOutput
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 Example_simple() {
43 fmt.Println("Test with Output.")
44
45 // Output: Test with Output.
46 }
47
48 func Example_withEmptyOutput() {
49 fmt.Println("")
50
51 // Output:
52 }
53
54 func Example_noOutput() {
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