another assert
This commit is contained in:
1 parent
3baa3c09a4
commit
86c5e22fa8
1 file changed
+6
@@ -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())...)
|
||||
|
||||
Reference in new issue
Block a user