diff options
Diffstat (limited to 'libgo/go/testing/example.go')
-rw-r--r-- | libgo/go/testing/example.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libgo/go/testing/example.go b/libgo/go/testing/example.go index 7f8ff2d..671c798 100644 --- a/libgo/go/testing/example.go +++ b/libgo/go/testing/example.go @@ -19,7 +19,7 @@ type InternalExample struct { Output string } -func RunExamples(examples []InternalExample) (ok bool) { +func RunExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ok bool) { ok = true var eg InternalExample @@ -27,6 +27,14 @@ func RunExamples(examples []InternalExample) (ok bool) { stdout, stderr := os.Stdout, os.Stderr for _, eg = range examples { + matched, err := matchString(*match, eg.Name) + if err != nil { + fmt.Fprintf(os.Stderr, "testing: invalid regexp for -test.run: %s\n", err) + os.Exit(1) + } + if !matched { + continue + } if *chatty { fmt.Printf("=== RUN: %s\n", eg.Name) } |