/
go19testing.go
36 lines (29 loc) · 1007 Bytes
/
go19testing.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// +build go1.9
package test
import (
"io"
"os"
"regexp"
"testing"
)
// testDeps is a copy of testing.testDeps
type testDeps interface {
MatchString(pat, str string) (bool, error)
StartCPUProfile(io.Writer) error
StopCPUProfile()
WriteHeapProfile(io.Writer) error
WriteProfileTo(string, io.Writer, int) error
ImportPath() string
}
type deps struct{}
var _ testDeps = &deps{}
func (d *deps) MatchString(pat, str string) (bool, error) { return regexp.MatchString(pat, str) }
func (d *deps) StartCPUProfile(_ io.Writer) error { return nil }
func (d *deps) StopCPUProfile() {}
func (d *deps) WriteHeapProfile(_ io.Writer) error { return nil }
func (d *deps) WriteProfileTo(_ string, _ io.Writer, _ int) error { return nil }
func (d *deps) ImportPath() string { return "" }
func mainStart(tests []testing.InternalTest) {
m := testing.MainStart(&deps{}, tests, nil, nil)
os.Exit(m.Run())
}