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