Fixes #261 - Add FailNow back

pull/262/head
Ernesto Jiménez 2016-01-08 12:25:24 +01:00
parent c92828f295
commit 7e30b2ce7a
5 changed files with 29 additions and 0 deletions

View File

@ -107,6 +107,12 @@ func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool
}
// FailNow fails test
func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool {
return FailNow(a.t, failureMessage, msgAndArgs...)
}
// False asserts that the specified value is false.
//
// a.False(myBool, "myBool should be false")

View File

@ -21,6 +21,7 @@ import (
// TestingT is an interface wrapper around *testing.T
type TestingT interface {
Errorf(format string, args ...interface{})
FailNow()
}
// Comparison a custom function that returns true on success and false on failure
@ -181,6 +182,13 @@ func indentMessageLines(message string, tabs int) string {
return outBuf.String()
}
// FailNow fails test
func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
Fail(t, failureMessage, msgAndArgs...)
t.FailNow()
return false
}
// Fail reports a failure through
func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {

View File

@ -17,6 +17,7 @@ import (
type TestingT interface {
Logf(format string, args ...interface{})
Errorf(format string, args ...interface{})
FailNow()
}
/*

View File

@ -126,6 +126,14 @@ func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
}
// FailNow fails test
func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
if !assert.FailNow(t, failureMessage, msgAndArgs...) {
t.FailNow()
}
}
// False asserts that the specified value is false.
//
// assert.False(t, myBool, "myBool should be false")

View File

@ -108,6 +108,12 @@ func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) {
}
// FailNow fails test
func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) {
FailNow(a.t, failureMessage, msgAndArgs...)
}
// False asserts that the specified value is false.
//
// a.False(myBool, "myBool should be false")