Skip to content

Commit 2fd71d2

Browse files
committed
suite: refactor methodFilter
Use strings.HasPrefix instead of a /^Test/ regexp (compiled on every call).
1 parent 0ff4bb4 commit 2fd71d2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

suite/suite.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"reflect"
88
"regexp"
99
"runtime/debug"
10+
"strings"
1011
"sync"
1112
"testing"
1213
"time"
@@ -227,7 +228,7 @@ func Run(t *testing.T, suite TestingSuite) {
227228
// Filtering method according to set regular expression
228229
// specified command-line argument -m
229230
func methodFilter(name string) (bool, error) {
230-
if ok, _ := regexp.MatchString("^Test", name); !ok {
231+
if !strings.HasPrefix(name, "Test") {
231232
return false, nil
232233
}
233234
return regexp.MatchString(*matchMethod, name)

0 commit comments

Comments
 (0)