mirror of https://github.com/stretchr/testify.git
Fix #263 - Backwards Incompatible change to TestingT
parent
38b5d653e3
commit
52f8b5b531
|
@ -21,6 +21,9 @@ import (
|
||||||
// TestingT is an interface wrapper around *testing.T
|
// TestingT is an interface wrapper around *testing.T
|
||||||
type TestingT interface {
|
type TestingT interface {
|
||||||
Errorf(format string, args ...interface{})
|
Errorf(format string, args ...interface{})
|
||||||
|
}
|
||||||
|
|
||||||
|
type FailNower interface {
|
||||||
FailNow()
|
FailNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +188,11 @@ func indentMessageLines(message string, tabs int) string {
|
||||||
// FailNow fails test
|
// FailNow fails test
|
||||||
func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
|
func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
|
||||||
Fail(t, failureMessage, msgAndArgs...)
|
Fail(t, failureMessage, msgAndArgs...)
|
||||||
|
if t, ok := t.(FailNower); ok {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
|
} else {
|
||||||
|
panic("test failed and t is missing `FailNow()`")
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue