summaryrefslogtreecommitdiff
path: root/src/lib/testing.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2008-11-18 17:52:05 -0800
committerRuss Cox <rsc@golang.org>2008-11-18 17:52:05 -0800
commit1cb73e2d964bff79bdc6a892a86e7c5522361ce4 (patch)
tree3e9402c5a919706f522bc82054084f6948d521d0 /src/lib/testing.go
parent0a4eee9f64d1d8be490ec218a9edb9a363b888e1 (diff)
downloadgolang-1cb73e2d964bff79bdc6a892a86e7c5522361ce4.tar.gz
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
Diffstat (limited to 'src/lib/testing.go')
-rw-r--r--src/lib/testing.go24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/lib/testing.go b/src/lib/testing.go
index 121baca88..a5d960fe8 100644
--- a/src/lib/testing.go
+++ b/src/lib/testing.go
@@ -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++ {
+ if chatty {
+ println("=== RUN ", tests[i].name);
+ }
ok1 := tests[i].f();
- status := "FAIL";
- if ok1 {
- status = "PASS"
+ 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");
}