summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runner.go19
-rw-r--r--runner_builder.go5
2 files changed, 11 insertions, 13 deletions
diff --git a/runner.go b/runner.go
index 1cc509e..d3d4b08 100644
--- a/runner.go
+++ b/runner.go
@@ -69,19 +69,11 @@ func (r Runner) build(tcs []TestCase) {
safeCd(r.dirs.Config())
}
-func (r Runner) init_adapters() {
- for _, adapter := range r.adapters {
- adapter.Init(r.dirs)
- }
-}
-
func (r Runner) units() []TestCase {
return collectUnits(r.dirs.Rubric(), r.adapterCfgs())
}
func (r Runner) Build() {
- r.init_adapters()
-
units := r.units()
if !directoryExists(r.dirs.Build()) {
@@ -105,7 +97,6 @@ func (r Runner) evaluate(tcs []TestCase) {
}
func (r Runner) Evaluate() []TestCase {
- r.init_adapters()
units := r.units()
@@ -129,3 +120,13 @@ func (r Runner) ConfigDir() string {
func (r Runner) SrcDir() string {
return r.dirs.Src()
}
+
+func NewRunner(adapters []Adapter, dirs DirConfig) Runner {
+ r := Runner{adapters, dirs}
+
+ for _, adapter := range r.adapters {
+ adapter.Init(dirs)
+ }
+
+ return r
+}
diff --git a/runner_builder.go b/runner_builder.go
index 848d09b..b369635 100644
--- a/runner_builder.go
+++ b/runner_builder.go
@@ -35,8 +35,5 @@ func SetSrcDir(b RunnerBuilder, dir string) RunnerBuilder {
}
func (b RunnerBuilder) New() Runner {
- return Runner {
- dirs: b.dirs,
- adapters: b.adapters,
- }
+ return NewRunner(b.adapters, b.dirs)
}