Skip to content

Commit 1c0572f

Browse files
committed
Add fuzzing types/functions to testing startup
1 parent a8900ea commit 1c0572f

File tree

3 files changed

+36
-11
lines changed

3 files changed

+36
-11
lines changed

src/testing/testing.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,9 @@ func newTestContext(m *matcher) *testContext {
416416
// M is a test suite.
417417
type M struct {
418418
// tests is a list of the test names to execute
419-
Tests []InternalTest
420-
Benchmarks []InternalBenchmark
419+
Tests []InternalTest
420+
Benchmarks []InternalBenchmark
421+
fuzzTargets []InternalFuzzTarget
421422

422423
deps testDeps
423424

@@ -430,15 +431,6 @@ type testDeps interface {
430431
MatchString(pat, str string) (bool, error)
431432
}
432433

433-
func MainStart(deps interface{}, tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample) *M {
434-
Init()
435-
return &M{
436-
Tests: tests,
437-
Benchmarks: benchmarks,
438-
deps: deps.(testDeps),
439-
}
440-
}
441-
442434
// Run runs the tests. It returns an exit code to pass to os.Exit.
443435
func (m *M) Run() (code int) {
444436
defer func() {

src/testing/testing_go118.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//go:build go1.18
2+
// +build go1.18
3+
4+
package testing
5+
6+
// MainStart is meant for use by tests generated by 'go test'.
7+
// It is not meant to be called directly and is not subject to the Go 1 compatibility document.
8+
// It may change signature from release to release.
9+
func MainStart(deps interface{}, tests []InternalTest, benchmarks []InternalBenchmark, fuzzTargets []InternalFuzzTarget, examples []InternalExample) *M {
10+
Init()
11+
return &M{
12+
Tests: tests,
13+
Benchmarks: benchmarks,
14+
fuzzTargets: fuzzTargets,
15+
deps: deps.(testDeps),
16+
}
17+
}

src/testing/testing_other.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//go:build !go1.18
2+
// +build !go1.18
3+
4+
package testing
5+
6+
// MainStart is meant for use by tests generated by 'go test'.
7+
// It is not meant to be called directly and is not subject to the Go 1 compatibility document.
8+
// It may change signature from release to release.
9+
func MainStart(deps interface{}, tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample) *M {
10+
Init()
11+
return &M{
12+
Tests: tests,
13+
Benchmarks: benchmarks,
14+
deps: deps.(testDeps),
15+
}
16+
}

0 commit comments

Comments
 (0)