checker: Add checker and tests

This commit is contained in:
Alexander Neumann committed 2015-07-11 16:27:41 +02:00
1 parent 54c4c29a89
commit 04f172b38d
4 files changed
+317 -19

No files matched your search

+15
View File
@@ -35,6 +35,21 @@ func OK(tb testing.TB, err error) {
}
}
// OKs fails the test if any error from errs is not nil.
func OKs(tb testing.TB, errs []error) {
errFound := false
for _, err := range errs {
if err != nil {
errFound = true
_, file, line, _ := runtime.Caller(1)
fmt.Printf("\033[31m%s:%d: unexpected error: %s\033[39m\n\n", filepath.Base(file), line, err.Error())
}
}
if errFound {
tb.FailNow()
}
}
// Equals fails the test if exp is not equal to act.
func Equals(tb testing.TB, exp, act interface{}) {
if !reflect.DeepEqual(exp, act) {