Fix #263 - Backwards Incompatible change to TestingT

pull/264/head
Ernesto Jiménez 2016-01-09 02:44:21 +01:00
parent 38b5d653e3
commit 52f8b5b531
1 changed files with 8 additions and 1 deletions

View File

@ -21,6 +21,9 @@ import (
// TestingT is an interface wrapper around *testing.T
type TestingT interface {
Errorf(format string, args ...interface{})
}
type FailNower interface {
FailNow()
}
@ -185,7 +188,11 @@ func indentMessageLines(message string, tabs int) string {
// FailNow fails test
func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
Fail(t, failureMessage, msgAndArgs...)
if t, ok := t.(FailNower); ok {
t.FailNow()
} else {
panic("test failed and t is missing `FailNow()`")
}
return false
}