From f43aa3c48841f6aa1c296b2fb71e5b3a0d70c8d2 Mon Sep 17 00:00:00 2001 From: ariley Date: Thu, 23 Apr 2020 13:10:43 +0100 Subject: [PATCH] Change to guard clause --- suite/suite.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/suite/suite.go b/suite/suite.go index fce5bfa..ce31c34 100644 --- a/suite/suite.go +++ b/suite/suite.go @@ -181,18 +181,19 @@ func Run(t *testing.T, suite TestingSuite) { func runTests(t testing.TB, tests []testing.InternalTest) { 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) + r, ok := t.(runner) + if !ok { // backwards compatibility with Go 1.6 and below + if !testing.RunTests(allTestsFilter, tests) { + t.Fail() } + return + } + + for _, test := range tests { + r.Run(test.Name, test.F) } }