summaryrefslogtreecommitdiff
path: root/src/lib/testing.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2008-11-18 15:29:10 -0800
committerRob Pike <r@golang.org>2008-11-18 15:29:10 -0800
commit222a73a2b7f01ef5c2a51fc936765d4a5f154f3c (patch)
treedf100da7e6fb2f8132dd834df4a9d351538aed97 /src/lib/testing.go
parenta01117e833a0a594737adb03647200ba94129dfc (diff)
downloadgolang-222a73a2b7f01ef5c2a51fc936765d4a5f154f3c.tar.gz
testing support library
R=rsc OCL=19496 CL=19496
Diffstat (limited to 'src/lib/testing.go')
-rw-r--r--src/lib/testing.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/testing.go b/src/lib/testing.go
new file mode 100644
index 000000000..121baca88
--- /dev/null
+++ b/src/lib/testing.go
@@ -0,0 +1,26 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package testing
+
+export type Test struct {
+ name string;
+ f *() bool;
+}
+
+export func Main(tests *[]Test) {
+ ok := true;
+ for i := 0; i < len(tests); i++ {
+ ok1 := tests[i].f();
+ status := "FAIL";
+ if ok1 {
+ status = "PASS"
+ }
+ ok = ok && ok1;
+ println(status, tests[i].name);
+ }
+ if !ok {
+ sys.exit(1);
+ }
+}