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,6 +179,9 @@ func Run(t *testing.T, suite TestingSuite) {
} }
func runTests(t testing.TB, tests []testing.InternalTest) { func runTests(t testing.TB, tests []testing.InternalTest) {
if len(tests) == 0 {
t.Log("warning: no tests to run")
} else {
r, ok := t.(runner) r, ok := t.(runner)
if !ok { // backwards compatibility with Go 1.6 and below if !ok { // backwards compatibility with Go 1.6 and below
if !testing.RunTests(allTestsFilter, tests) { if !testing.RunTests(allTestsFilter, tests) {
@ -190,6 +193,7 @@ func runTests(t testing.TB, tests []testing.InternalTest) {
for _, test := range tests { for _, test := range tests {
r.Run(test.Name, test.F) r.Run(test.Name, test.F)
} }
}
} }
// Filtering method according to set regular expression // Filtering method according to set regular expression