Change-Id: I2fa547d1074ef0931196066678fadd7250a1148d
Reviewed-on: https://go-review.googlesource.com/121936
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
// Short reports whether the -test.short flag is set.
func Short() bool {
+ // Catch code that calls this from TestMain without first
+ // calling flag.Parse. This shouldn't really be a panic
+ if !flag.Parsed() {
+ fmt.Fprintf(os.Stderr, "testing: testing.Short called before flag.Parse\n")
+ os.Exit(2)
+ }
+
return *short
}