Commit 85a3fb96 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

internal/testutil: switch off debug if test is called TestNonVerbose

Change-Id: I71cd7cb713c7e864305ebad73a1b072395c13b27
parent 6625411c
......@@ -4,10 +4,20 @@
package testutil
import "flag"
import (
"bytes"
"flag"
"runtime"
)
// VerboseTest returns true if the testing framework is run with -v.
func VerboseTest() bool {
var buf [2048]byte
n := runtime.Stack(buf[:], false)
if bytes.Index(buf[:n], []byte("TestNonVerbose")) != -1 {
return false
}
flag := flag.Lookup("test.v")
return flag != nil && flag.Value.String() == "true"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment