...

Text file src/go/doc/testdata/testing.2.golden

Documentation: go/doc/testdata

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

View as plain text