testing: eliminate testing/regexp

Rather than updating the stripped-down regexp implementation embedded
in testing, delete it by passing the one function we need from the package
main file created by gotest.

R=rsc
CC=golang-dev
https://golang.org/cl/2761043
This commit is contained in:
Rob Pike 2010-10-28 16:54:24 -07:00
parent 1f4d54ea01
commit 4e9cc085d2
10 changed files with 26 additions and 917 deletions

View file

@ -135,19 +135,19 @@ func tRunner(t *T, test *Test) {
// An internal function but exported because it is cross-package; part of the implementation
// of gotest.
func Main(tests []Test) {
func Main(matchString func(pat, str string) (bool, os.Error), tests []Test) {
flag.Parse()
ok := true
if len(tests) == 0 {
println("testing: warning: no tests to run")
}
re, err := CompileRegexp(*match)
if err != "" {
println("invalid regexp for -match:", err)
os.Exit(1)
}
for i := 0; i < len(tests); i++ {
if !re.MatchString(tests[i].Name) {
matched, err := matchString(*match, tests[i].Name)
if err != nil {
println("invalid regexp for -match:", err)
os.Exit(1)
}
if !matched {
continue
}
if *chatty {