Skip to content

Commit 3b29828

Browse files
committed
Update test main template to match current version in Go 1.8.
See golang/go@c56cc9b?w=1. Fixes the following issue when running gopherjs test: _testmain.go:162:25: cannot use matchString (value of type func(pat string, str string) (result bool, err error)) as testing.testDeps value in argument to testing.MainStart: missing method MatchString
1 parent 7eafb90 commit 3b29828

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

tool.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,8 @@ import (
892892
{{if not .TestMain}}
893893
"os"
894894
{{end}}
895-
"regexp"
896895
"testing"
896+
"testing/internal/testdeps"
897897
898898
{{if .ImportTest}}
899899
{{if .NeedTest}}_test{{else}}_{{end}} {{.Package.ImportPath | printf "%q"}}
@@ -921,22 +921,8 @@ var examples = []testing.InternalExample{
921921
{{end}}
922922
}
923923
924-
var matchPat string
925-
var matchRe *regexp.Regexp
926-
927-
func matchString(pat, str string) (result bool, err error) {
928-
if matchRe == nil || matchPat != pat {
929-
matchPat = pat
930-
matchRe, err = regexp.Compile(matchPat)
931-
if err != nil {
932-
return
933-
}
934-
}
935-
return matchRe.MatchString(str), nil
936-
}
937-
938924
func main() {
939-
m := testing.MainStart(matchString, tests, benchmarks, examples)
925+
m := testing.MainStart(testdeps.TestDeps{}, tests, benchmarks, examples)
940926
{{with .TestMain}}
941927
{{.Package}}.{{.Name}}(m)
942928
{{else}}

0 commit comments

Comments
 (0)