...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package kiviktest
16
17 import (
18 "io"
19 "os"
20 "regexp"
21 "testing"
22 )
23
24
25 type testDeps interface {
26 ImportPath() string
27 MatchString(pat, str string) (bool, error)
28 StartCPUProfile(io.Writer) error
29 StopCPUProfile()
30 StartTestLog(io.Writer)
31 StopTestLog() error
32 WriteHeapProfile(io.Writer) error
33 WriteProfileTo(string, io.Writer, int) error
34 SetPanicOnExit0(bool)
35 }
36
37 type deps struct{}
38
39 var _ testDeps = &deps{}
40
41 func (d *deps) MatchString(pat, str string) (bool, error) { return regexp.MatchString(pat, str) }
42 func (d *deps) StartCPUProfile(_ io.Writer) error { return nil }
43 func (d *deps) StopCPUProfile() {}
44 func (d *deps) WriteHeapProfile(_ io.Writer) error { return nil }
45 func (d *deps) WriteProfileTo(_ string, _ io.Writer, _ int) error { return nil }
46 func (d *deps) ImportPath() string { return "" }
47 func (d *deps) StartTestLog(io.Writer) {}
48 func (d *deps) StopTestLog() error { return nil }
49 func (d *deps) SetPanicOnExit0(bool) {}
50
51 func mainStart(tests []testing.InternalTest) {
52 m := testing.MainStart(&deps{}, tests, nil, nil)
53 os.Exit(m.Run())
54 }
55
View as plain text