mirror of https://github.com/stretchr/testify.git
commit
38b5d653e3
|
@ -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")
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import (
|
|||
type TestingT interface {
|
||||
Logf(format string, args ...interface{})
|
||||
Errorf(format string, args ...interface{})
|
||||
FailNow()
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue