mirror of
https://github.com/golang/go
synced 2024-11-13 19:10:22 -07:00
testing support library
R=rsc OCL=19496 CL=19496
This commit is contained in:
parent
8b8630c6cf
commit
7969860126
26
src/lib/testing.go
Normal file
26
src/lib/testing.go
Normal file
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user