testing: add -test.example flag to control execution of examples

Also, don't run examples if -test.run is set.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5697069
This commit is contained in:
Rob Pike 2012-02-27 12:49:10 +11:00
parent c7482b9196
commit 5876b4eb28
4 changed files with 23 additions and 2 deletions

View file

@ -280,7 +280,7 @@ func Main(matchString func(pat, str string) (bool, error), tests []InternalTest,
before()
startAlarm()
testOk := RunTests(matchString, tests)
exampleOk := RunExamples(examples)
exampleOk := RunExamples(matchString, examples)
if !testOk || !exampleOk {
fmt.Println("FAIL")
os.Exit(1)