mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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
This commit is contained in:
parent
c5f4867ffa
commit
23bd1298f7
1 changed files with 20 additions and 6 deletions
|
|
@ -4,23 +4,37 @@
|
|||
|
||||
package testing
|
||||
|
||||
import (
|
||||
"flag"
|
||||
)
|
||||
|
||||
var chatty bool;
|
||||
func init() {
|
||||
flag.Bool("chatty", false, &chatty, "chatty");
|
||||
}
|
||||
|
||||
export type Test struct {
|
||||
name string;
|
||||
f *() bool;
|
||||
}
|
||||
|
||||
export func Main(tests *[]Test) {
|
||||
flag.Parse();
|
||||
ok := true;
|
||||
for i := 0; i < len(tests); i++ {
|
||||
ok1 := tests[i].f();
|
||||
status := "FAIL";
|
||||
if ok1 {
|
||||
status = "PASS"
|
||||
if chatty {
|
||||
println("=== RUN ", tests[i].name);
|
||||
}
|
||||
ok1 := tests[i].f();
|
||||
if !ok1 {
|
||||
ok = false;
|
||||
println("--- FAIL", tests[i].name);
|
||||
} else if chatty {
|
||||
println("--- PASS", tests[i].name);
|
||||
}
|
||||
ok = ok && ok1;
|
||||
println(status, tests[i].name);
|
||||
}
|
||||
if !ok {
|
||||
sys.exit(1);
|
||||
}
|
||||
println("PASS");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue