testing: import new version of match.go

This commit is contained in:
Damian Gryski
2023-03-31 12:54:03 -07:00
committed by Damian Gryski
parent 50d681359d
commit ee81c31884
4 changed files with 349 additions and 126 deletions
+12 -1
View File
@@ -499,7 +499,7 @@ func (m *M) Run() (code int) {
func runTests(matchString func(pat, str string) (bool, error), tests []InternalTest) (ran, ok bool) {
ok = true
ctx := newTestContext(newMatcher(matchString, flagRunRegexp, "-test.run"))
ctx := newTestContext(newMatcher(matchString, flagRunRegexp, "-test.run", ""))
t := &T{
common: common{
output: &logger{logToStdout: flagVerbose},
@@ -567,3 +567,14 @@ func MainStart(deps interface{}, tests []InternalTest, benchmarks []InternalBenc
deps: deps.(testDeps),
}
}
// A fake regexp matcher.
// Inflexible, but saves 50KB of flash and 50KB of RAM per -size full,
// and lets tests pass on cortex-m.
func fakeMatchString(pat, str string) (bool, error) {
if pat == ".*" {
return true, nil
}
matched := strings.Contains(str, pat)
return matched, nil
}