-
Notifications
You must be signed in to change notification settings - Fork 5
/
main_test.go
38 lines (32 loc) · 962 Bytes
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"fmt"
cfg "github.com/mrlsd/go-benchmark-app/config"
"github.com/mrlsd/go-benchmark-app/tools"
"testing"
)
// runBenchmarksSuccess - alias for success Run Benchmarks
var runBenchmarksSuccess = func(config *cfg.Config) (tools.AggreatedResults, error) {
println(" => runBenchmarksSuccess")
return tools.AggreatedResults{}, nil
}
// runBenchmarksFailed - alias for failed Run Benchmarks
var runBenchmarksFailed = func(config *cfg.Config) (tools.AggreatedResults, error) {
println(" => runBenchmarksFailed")
return tools.AggreatedResults{}, fmt.Errorf("test %s", "test")
}
func TestMain(t *testing.T) {
RunBenchmarks = runBenchmarksSuccess
LogFatal = func(v ...interface{}) {
fmt.Println(v...)
}
main()
// Test FAILED config
cfg.ConfigFile = "config/_main.toml"
main()
// Return truly config - for next tests
cfg.ConfigFile = "config/main.toml"
// Test Benchmarks Failed
RunBenchmarks = runBenchmarksFailed
main()
}