diff options
author | Russ Cox <rsc@golang.org> | 2009-06-04 15:40:28 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-06-04 15:40:28 -0700 |
commit | f654e133f370e1a0cfade41e9bdce82f893d0526 (patch) | |
tree | ec2647dfe3542fcefe1934ab289f86c7dc40cac6 /src/lib | |
parent | 0c6945cf66e2cd24523545a33d1628219bcf3dd1 (diff) | |
download | golang-f654e133f370e1a0cfade41e9bdce82f893d0526.tar.gz |
rename -chatty to more conventional -v.
add -match flag to select tests.
gotest -match 'TestDeepEqual$'
R=r
DELTA=13 (12 added, 0 deleted, 1 changed)
OCL=29900
CL=29900
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/testing/testing.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/testing/testing.go b/src/lib/testing/testing.go index 3a33b91ad..330fadd3a 100644 --- a/src/lib/testing/testing.go +++ b/src/lib/testing/testing.go @@ -15,11 +15,14 @@ import ( "flag"; "fmt"; "os"; + "regexp"; "runtime"; ) // Report as tests are run; default is silent for success. -var chatty = flag.Bool("chatty", false, "chatty") +var chatty = flag.Bool("v", false, "verbose: print additional output") +var match = flag.String("match", "", "regular expression to select tests to run") + // Insert final newline if needed and tabs after internal newlines. func tabify(s string) string { @@ -114,11 +117,20 @@ func tRunner(t *T, test *Test) { // of gotest. func Main(tests []Test) { flag.Parse(); + args := flag.Args(); ok := true; if len(tests) == 0 { println("testing: warning: no tests to run"); } + re, err := regexp.Compile(*match); + if err != nil { + println("invalid regexp for -match:", err.String()); + os.Exit(1); + } for i := 0; i < len(tests); i++ { + if !re.Match(tests[i].Name) { + continue; + } if *chatty { println("=== RUN ", tests[i].Name); } |