Permalink
Browse files

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
  • Loading branch information...
1 parent 0ff5023 commit bc37a6304983c46e865a957fcca81eb47fad36e4 @shurcooL shurcooL committed Dec 13, 2016
Showing with 2 additions and 16 deletions.
  1. +2 −16 tool.go
View
@@ -919,8 +919,8 @@ import (
{{if not .TestMain}}
"os"
{{end}}
- "regexp"
"testing"
+ "testing/internal/testdeps"
{{if .ImportTest}}
{{if .NeedTest}}_test{{else}}_{{end}} {{.Package.ImportPath | printf "%q"}}
@@ -948,22 +948,8 @@ var examples = []testing.InternalExample{
{{end}}
}
-var matchPat string
-var matchRe *regexp.Regexp
-
-func matchString(pat, str string) (result bool, err error) {
- if matchRe == nil || matchPat != pat {
- matchPat = pat
- matchRe, err = regexp.Compile(matchPat)
- if err != nil {
- return
- }
- }
- return matchRe.MatchString(str), nil
-}
-
func main() {
- m := testing.MainStart(matchString, tests, benchmarks, examples)
+ m := testing.MainStart(testdeps.TestDeps{}, tests, benchmarks, examples)
{{with .TestMain}}
{{.Package}}.{{.Name}}(m)
{{else}}

0 comments on commit bc37a63

Please sign in to comment.