github.com/goproxy0/go@v0.0.0-20171111080102-49cc0c489d2c/src/go/doc/testdata/testing.0.golden (about) 1 // Package testing provides support for automated testing of Go ... 2 PACKAGE testing 3 4 IMPORTPATH 5 testdata/testing 6 7 IMPORTS 8 bytes 9 flag 10 fmt 11 io 12 os 13 runtime 14 runtime/pprof 15 strconv 16 strings 17 time 18 19 FILENAMES 20 testdata/benchmark.go 21 testdata/example.go 22 testdata/testing.go 23 24 FUNCTIONS 25 // An internal function but exported because it is cross-package; ... 26 func Main(matchString func(pat, str string) (bool, error), tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample) 27 28 // An internal function but exported because it is cross-package; ... 29 func RunBenchmarks(matchString func(pat, str string) (bool, error), benchmarks []InternalBenchmark) 30 31 // 32 func RunExamples(examples []InternalExample) (ok bool) 33 34 // 35 func RunTests(matchString func(pat, str string) (bool, error), tests []InternalTest) (ok bool) 36 37 // Short reports whether the -test.short flag is set. 38 func Short() bool 39 40 41 TYPES 42 // B is a type passed to Benchmark functions to manage benchmark ... 43 type B struct { 44 N int 45 46 // contains filtered or unexported fields 47 } 48 49 // Error is equivalent to Log() followed by Fail(). 50 func (c *B) Error(args ...interface{}) 51 52 // Errorf is equivalent to Logf() followed by Fail(). 53 func (c *B) Errorf(format string, args ...interface{}) 54 55 // Fail marks the function as having failed but continues ... 56 func (c *B) Fail() 57 58 // FailNow marks the function as having failed and stops its ... 59 func (c *B) FailNow() 60 61 // Failed reports whether the function has failed. 62 func (c *B) Failed() bool 63 64 // Fatal is equivalent to Log() followed by FailNow(). 65 func (c *B) Fatal(args ...interface{}) 66 67 // Fatalf is equivalent to Logf() followed by FailNow(). 68 func (c *B) Fatalf(format string, args ...interface{}) 69 70 // Log formats its arguments using default formatting, analogous ... 71 func (c *B) Log(args ...interface{}) 72 73 // Logf formats its arguments according to the format, analogous ... 74 func (c *B) Logf(format string, args ...interface{}) 75 76 // ResetTimer sets the elapsed benchmark time to zero. It does not ... 77 func (b *B) ResetTimer() 78 79 // SetBytes records the number of bytes processed in a single ... 80 func (b *B) SetBytes(n int64) 81 82 // StartTimer starts timing a test. This function is called ... 83 func (b *B) StartTimer() 84 85 // StopTimer stops timing a test. This can be used to pause the ... 86 func (b *B) StopTimer() 87 88 // The results of a benchmark run. 89 type BenchmarkResult struct { 90 N int // The number of iterations. 91 T time.Duration // The total time taken. 92 Bytes int64 // Bytes processed in one iteration. 93 } 94 95 // Benchmark benchmarks a single function. Useful for creating ... 96 func Benchmark(f func(b *B)) BenchmarkResult 97 98 // 99 func (r BenchmarkResult) NsPerOp() int64 100 101 // 102 func (r BenchmarkResult) String() string 103 104 // An internal type but exported because it is cross-package; part ... 105 type InternalBenchmark struct { 106 Name string 107 F func(b *B) 108 } 109 110 // 111 type InternalExample struct { 112 Name string 113 F func() 114 Output string 115 } 116 117 // An internal type but exported because it is cross-package; part ... 118 type InternalTest struct { 119 Name string 120 F func(*T) 121 } 122 123 // T is a type passed to Test functions to manage test state and ... 124 type T struct { 125 // contains filtered or unexported fields 126 } 127 128 // Error is equivalent to Log() followed by Fail(). 129 func (c *T) Error(args ...interface{}) 130 131 // Errorf is equivalent to Logf() followed by Fail(). 132 func (c *T) Errorf(format string, args ...interface{}) 133 134 // Fail marks the function as having failed but continues ... 135 func (c *T) Fail() 136 137 // FailNow marks the function as having failed and stops its ... 138 func (c *T) FailNow() 139 140 // Failed reports whether the function has failed. 141 func (c *T) Failed() bool 142 143 // Fatal is equivalent to Log() followed by FailNow(). 144 func (c *T) Fatal(args ...interface{}) 145 146 // Fatalf is equivalent to Logf() followed by FailNow(). 147 func (c *T) Fatalf(format string, args ...interface{}) 148 149 // Log formats its arguments using default formatting, analogous ... 150 func (c *T) Log(args ...interface{}) 151 152 // Logf formats its arguments according to the format, analogous ... 153 func (c *T) Logf(format string, args ...interface{}) 154 155 // Parallel signals that this test is to be run in parallel with ... 156 func (t *T) Parallel() 157