blob: a5d960fe8076ae0139840d5df9169ca70d3d0054 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// 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
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();
if !ok1 {
ok = false;
println("--- FAIL", tests[i].name);
} else if chatty {
println("--- PASS", tests[i].name);
}
}
if !ok {
sys.exit(1);
}
println("PASS");
}
|