cmd/go: drop -example, apply -run to examples

Once more, with feeling.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5698080
This commit is contained in:
Rob Pike 2012-02-28 08:33:06 +11:00
parent 1f5fde0915
commit ec15046a8d
4 changed files with 3 additions and 16 deletions

View file

@ -6,7 +6,6 @@ package testing
import (
"bytes"
"flag"
"fmt"
"io"
"os"
@ -14,8 +13,6 @@ import (
"time"
)
var matchExamples = flag.String("test.example", "", "regular expression to select examples to run")
type InternalExample struct {
Name string
F func()
@ -23,9 +20,6 @@ type InternalExample struct {
}
func RunExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ok bool) {
if *match != "" && *matchExamples == "" {
return // Don't run examples if testing is restricted: we're debugging.
}
ok = true
var eg InternalExample
@ -33,9 +27,9 @@ func RunExamples(matchString func(pat, str string) (bool, error), examples []Int
stdout, stderr := os.Stdout, os.Stderr
for _, eg = range examples {
matched, err := matchString(*matchExamples, eg.Name)
matched, err := matchString(*match, eg.Name)
if err != nil {
fmt.Fprintf(os.Stderr, "testing: invalid regexp for -test.example: %s\n", err)
fmt.Fprintf(os.Stderr, "testing: invalid regexp for -test.run: %s\n", err)
os.Exit(1)
}
if !matched {