main: fix tests with default TestConfig.Count=0 doesn't skip all tests
Этот коммит содержится в:
родитель
9182664845
коммит
84a3273131
2 изменённых файлов: 4 добавлений и 4 удалений
|
@ -545,7 +545,7 @@ type TestConfig struct {
|
||||||
Verbose bool
|
Verbose bool
|
||||||
Short bool
|
Short bool
|
||||||
RunRegexp string
|
RunRegexp string
|
||||||
Count int
|
Count *int
|
||||||
BenchRegexp string
|
BenchRegexp string
|
||||||
BenchTime string
|
BenchTime string
|
||||||
BenchMem bool
|
BenchMem bool
|
||||||
|
|
6
main.go
6
main.go
|
@ -245,8 +245,8 @@ func Test(pkgName string, stdout, stderr io.Writer, options *compileopts.Options
|
||||||
if testConfig.BenchMem {
|
if testConfig.BenchMem {
|
||||||
flags = append(flags, "-test.benchmem")
|
flags = append(flags, "-test.benchmem")
|
||||||
}
|
}
|
||||||
if testConfig.Count != 1 {
|
if testConfig.Count != nil && *testConfig.Count != 1 {
|
||||||
flags = append(flags, "-test.count="+strconv.Itoa(testConfig.Count))
|
flags = append(flags, "-test.count="+strconv.Itoa(*testConfig.Count))
|
||||||
}
|
}
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
@ -1420,7 +1420,7 @@ func main() {
|
||||||
flag.BoolVar(&testConfig.Verbose, "v", false, "verbose: print additional output")
|
flag.BoolVar(&testConfig.Verbose, "v", false, "verbose: print additional output")
|
||||||
flag.BoolVar(&testConfig.Short, "short", false, "short: run smaller test suite to save time")
|
flag.BoolVar(&testConfig.Short, "short", false, "short: run smaller test suite to save time")
|
||||||
flag.StringVar(&testConfig.RunRegexp, "run", "", "run: regexp of tests to run")
|
flag.StringVar(&testConfig.RunRegexp, "run", "", "run: regexp of tests to run")
|
||||||
flag.IntVar(&testConfig.Count, "count", 1, "count: number of times to run tests/benchmarks `count` times")
|
testConfig.Count = flag.Int("count", 1, "count: number of times to run tests/benchmarks `count` times")
|
||||||
flag.StringVar(&testConfig.BenchRegexp, "bench", "", "run: regexp of benchmarks to run")
|
flag.StringVar(&testConfig.BenchRegexp, "bench", "", "run: regexp of benchmarks to run")
|
||||||
flag.StringVar(&testConfig.BenchTime, "benchtime", "", "run each benchmark for duration `d`")
|
flag.StringVar(&testConfig.BenchTime, "benchtime", "", "run each benchmark for duration `d`")
|
||||||
flag.BoolVar(&testConfig.BenchMem, "benchmem", false, "show memory stats for benchmarks")
|
flag.BoolVar(&testConfig.BenchMem, "benchmem", false, "show memory stats for benchmarks")
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче