another assert

This commit is contained in:
Matthias Radestock committed 2015-01-22 16:43:07 +00:00
1 parent 3baa3c09a4
commit 86c5e22fa8
1 file changed
+6
+6
View File
@@ -58,6 +58,12 @@ func AssertType(t *testing.T, got interface{}, wanted interface{}, desc string)
}
}
func AssertEmpty(t *testing.T, array interface{}, desc string) {
if reflect.ValueOf(array).Len() != 0 {
Fatalf(t, "Expected empty %s but got %s", desc, array)
}
}
// Like testing.Fatalf, but adds the stack trace of the current call
func Fatalf(t *testing.T, format string, args ...interface{}) {
t.Fatalf(format+"\n%s", append(args, StackTrace())...)