Initialize test to fix flag parsing issue (Closes: #952199)
Nilesh Patra
4 years ago
0 | Description: Initialize test so that test flags can be parsed during execution. | |
1 | --- a/quick_test.go | |
2 | +++ b/quick_test.go | |
3 | @@ -8,6 +8,7 @@ | |
4 | "os" | |
5 | "reflect" | |
6 | "testing/quick" | |
7 | + "testing" | |
8 | "time" | |
9 | ) | |
10 | ||
11 | @@ -23,6 +24,11 @@ | |
12 | ||
13 | var qcount, qseed, qmaxitems, qmaxksize, qmaxvsize int | |
14 | ||
15 | +var testinit = func() bool { | |
16 | + testing.Init() | |
17 | + return true | |
18 | +}() | |
19 | + | |
20 | func init() { | |
21 | flag.IntVar(&qcount, "quick.count", 5, "") | |
22 | flag.IntVar(&qseed, "quick.seed", int(time.Now().UnixNano())%100000, "") |