...
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
26
27 type testDeps interface {
28 MatchString(pat, str string) (bool, error)
29 StartCPUProfile(io.Writer) error
30 StopCPUProfile()
31 WriteHeapProfile(io.Writer) error
32 WriteProfileTo(string, io.Writer, int) error
33 }
34
35 type deps struct{}
36
37 var _ testDeps = &deps{}
38
39 func (d *deps) MatchString(pat, str string) (bool, error) { return regexp.MatchString(pat, str) }
40 func (d *deps) StartCPUProfile(_ io.Writer) error { return nil }
41 func (d *deps) StopCPUProfile() {}
42 func (d *deps) WriteHeapProfile(_ io.Writer) error { return nil }
43 func (d *deps) WriteProfileTo(_ string, _ io.Writer, _ int) error { return nil }
44
45 func mainStart(tests []testing.InternalTest) {
46 m := testing.MainStart(&deps{}, tests, nil, nil)
47 os.Exit(m.Run())
48 }
49
View as plain text