Add warning in log when no tests are run within a suite

pull/579/merge
ariley 2020-04-19 22:26:07 +01:00 committed by Martijn
parent 36f3f1ec85
commit a41f2db807
1 changed files with 12 additions and 8 deletions

View File

@ -179,16 +179,20 @@ func Run(t *testing.T, suite TestingSuite) {
}
func runTests(t testing.TB, tests []testing.InternalTest) {
r, ok := t.(runner)
if !ok { // backwards compatibility with Go 1.6 and below
if !testing.RunTests(allTestsFilter, tests) {
t.Fail()
if len(tests) == 0 {
t.Log("warning: no tests to run")
} else {
r, ok := t.(runner)
if !ok { // backwards compatibility with Go 1.6 and below
if !testing.RunTests(allTestsFilter, tests) {
t.Fail()
}
return
}
return
}
for _, test := range tests {
r.Run(test.Name, test.F)
for _, test := range tests {
r.Run(test.Name, test.F)
}
}
}