Commit 23bd1298 authored by Russ Cox's avatar Russ Cox

add -chatty flag to test.

was supposed to be in some other cl but got dropped.

R=r
DELTA=21  (16 added, 2 deleted, 3 changed)
OCL=19531
CL=19539
parent c5f4867f
...@@ -4,23 +4,37 @@ ...@@ -4,23 +4,37 @@
package testing package testing
import (
"flag"
)
var chatty bool;
func init() {
flag.Bool("chatty", false, &chatty, "chatty");
}
export type Test struct { export type Test struct {
name string; name string;
f *() bool; f *() bool;
} }
export func Main(tests *[]Test) { export func Main(tests *[]Test) {
flag.Parse();
ok := true; ok := true;
for i := 0; i < len(tests); i++ { for i := 0; i < len(tests); i++ {
if chatty {
println("=== RUN ", tests[i].name);
}
ok1 := tests[i].f(); ok1 := tests[i].f();
status := "FAIL"; if !ok1 {
if ok1 { ok = false;
status = "PASS" println("--- FAIL", tests[i].name);
} else if chatty {
println("--- PASS", tests[i].name);
} }
ok = ok && ok1;
println(status, tests[i].name);
} }
if !ok { if !ok {
sys.exit(1); sys.exit(1);
} }
println("PASS");
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment