testing: added name matcher and sanitizer

The matcher is responsible for sanitizing and uniquing the
test and benchmark names and thus needs to be included before the
API can be exposed.

Matching currently uses the regexp to only match the top-level
tests/benchmarks.

Support for subtest matching is for another CL.

Change-Id: I7c8464068faef7ebc179b03a7fe3d01122cc4f0b
Reviewed-on: https://go-review.googlesource.com/18897
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Marcel van Lohuizen 2016-01-29 16:57:02 +01:00
parent 34699bc7a8
commit 00a2a94c1e
5 changed files with 207 additions and 26 deletions

View file

@ -6,6 +6,7 @@ package testing
import (
"io/ioutil"
"regexp"
"sync/atomic"
"time"
)
@ -305,11 +306,12 @@ func TestTRun(t *T) {
},
}}
for _, tc := range testCases {
ctx := newTestContext(tc.maxPar)
ctx := newTestContext(tc.maxPar, newMatcher(regexp.MatchString, "", ""))
root := &T{
common: common{
barrier: make(chan bool),
w: ioutil.Discard,
signal: make(chan bool),
name: "Test",
w: ioutil.Discard,
},
context: ctx,
}