add support for -test.short flag

This commit is contained in:
Damian Gryski
2021-09-27 10:13:21 -07:00
committed by Ron Evans
parent d9ad500cf7
commit 0dfb336563
2 changed files with 17 additions and 5 deletions
+7
View File
@@ -19,6 +19,7 @@ import (
// Testing flags.
var (
flagVerbose bool
flagShort bool
)
var initRan bool
@@ -31,6 +32,7 @@ func Init() {
initRan = true
flag.BoolVar(&flagVerbose, "test.v", false, "verbose: print additional output")
flag.BoolVar(&flagShort, "test.short", false, "short: run smaller test suite to save time")
}
// common holds the elements common between T and B and
@@ -282,6 +284,11 @@ func (m *M) Run() int {
return failures
}
// Short reports whether the -test.short flag is set.
func Short() bool {
return flagShort
}
func TestMain(m *M) {
os.Exit(m.Run())
}