chore: Use go-check fork.

This commit is contained in:
Fernandez Ludovic 2017-09-15 21:08:13 +02:00 committed by Traefiker
parent 3942f3366d
commit ce3b255f1a
7 changed files with 152 additions and 103 deletions

View file

@ -42,6 +42,7 @@ var (
newBenchMem = flag.Bool("check.bmem", false, "Report memory benchmarks")
newListFlag = flag.Bool("check.list", false, "List the names of all tests that will be run")
newWorkFlag = flag.Bool("check.work", false, "Display and do not remove the test working directory")
abort = flag.Bool("check.abort", true, "Stop testing the suite if a test has failed")
)
// TestingT runs all test suites registered with the Suite function,
@ -60,6 +61,7 @@ func TestingT(testingT *testing.T) {
BenchmarkTime: benchTime,
BenchmarkMem: *newBenchMem,
KeepWorkDir: *oldWorkFlag || *newWorkFlag,
Abort: *abort,
}
if *oldListFlag || *newListFlag {
w := bufio.NewWriter(os.Stdout)
@ -80,8 +82,21 @@ func TestingT(testingT *testing.T) {
// provided run configuration.
func RunAll(runConf *RunConf) *Result {
result := Result{}
skipTests := false
for _, suite := range allSuites {
result.Add(Run(suite, runConf))
var res *Result
if skipTests {
// Count missed tests.
res = skipSuite(suite, runConf)
} else {
res = Run(suite, runConf)
}
result.Add(res)
if runConf.Abort && (res.Failed > 0 || res.Panicked > 0) {
skipTests = true
continue
}
}
return &result
}
@ -92,6 +107,11 @@ func Run(suite interface{}, runConf *RunConf) *Result {
return runner.run()
}
func skipSuite(suite interface{}, runConf *RunConf) *Result {
runner := newSuiteRunner(suite, runConf)
return runner.skip()
}
// ListAll returns the names of all the test functions registered with the
// Suite function that will be run with the provided run configuration.
func ListAll(runConf *RunConf) []string {