Documentation ¶
Overview ¶
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
Example Usage ¶
The following is a complete example using assert in a standard test function:
import ( "testing" "github.com/stretchr/testify/assert" ) func TestSomething(t *testing.T) { var a string = "Hello" var b string = "Hello" assert.Equal(t, a, b, "The two words should be the same.") }
if you assert many times, use the format below:
import ( "testing" "github.com/stretchr/testify/assert" ) func TestSomething(t *testing.T) { assert := assert.New(t) var a string = "Hello" var b string = "Hello" assert.Equal(a, b, "The two words should be the same.") }
Assertions ¶
Assertions allow you to easily write test code, and are global funcs in the `assert` package. All assertion functions take, as the first argument, the `*testing.T` object provided by the testing framework. This allows the assertion funcs to write the failings and other details to the correct place.
Every assertion function also takes an optional string message as the final argument, allowing custom error messages to be appended to the message the assertion method outputs.
Index ¶
- Variables
- func CallerInfo() []string
- func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool
- func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool
- func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool
- func Containsf(t TestingT, s interface{}, contains interface{}, msg string, ...) bool
- func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool
- func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool
- func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool
- func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool
- func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool
- func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool
- func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, ...) bool
- func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, ...) bool
- func Error(t TestingT, err error, msgAndArgs ...interface{}) bool
- func Errorf(t TestingT, err error, msg string, args ...interface{}) bool
- func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool
- func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, ...) bool
- func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool
- func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool
- func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool
- func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool
- func False(t TestingT, value bool, msgAndArgs ...interface{}) bool
- func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool
- func GetContextDiffString(diff ContextDiff) (string, error)
- func GetUnifiedDiffString(diff UnifiedDiff) (string, error)
- func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string
- func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, ...) bool
- func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, ...) bool
- func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, ...) bool
- func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, ...) bool
- func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool
- func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, ...) bool
- func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool
- func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, ...) bool
- func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool
- func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, ...) bool
- func Implements(t TestingT, interfaceObject interface{}, object interface{}, ...) bool
- func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, ...) bool
- func InDelta(t TestingT, expected, actual interface{}, delta float64, ...) bool
- func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, ...) bool
- func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, ...) bool
- func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, ...) bool
- func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, ...) bool
- func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, ...) bool
- func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, ...) bool
- func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, ...) bool
- func IsType(t TestingT, expectedType interface{}, object interface{}, ...) bool
- func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, ...) bool
- func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool
- func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool
- func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool
- func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool
- func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool
- func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool
- func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool
- func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool
- func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool
- func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, ...) bool
- func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool
- func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool
- func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool
- func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, ...) bool
- func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool
- func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool
- func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool
- func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool
- func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool
- func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool
- func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool)
- func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, ...) bool
- func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool
- func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool
- func ObjectsAreEqual(expected, actual interface{}) bool
- func ObjectsAreEqualValues(expected, actual interface{}) bool
- func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool
- func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool
- func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, ...) bool
- func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool
- func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool
- func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool
- func SplitLines(s string) []string
- func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool)
- func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, ...) bool
- func True(t TestingT, value bool, msgAndArgs ...interface{}) bool
- func Truef(t TestingT, value bool, msg string, args ...interface{}) bool
- func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, ...) bool
- func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, ...) bool
- func WriteContextDiff(writer io.Writer, diff ContextDiff) error
- func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error
- func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool
- func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool
- type Assertions
- func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool
- func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool
- func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool
- func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool
- func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool
- func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool
- func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool
- func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool
- func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool
- func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool
- func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool
- func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool
- func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) bool
- func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values) bool
- func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) bool
- func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values) bool
- func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) bool
- func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values) bool
- func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, ...) bool
- func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, ...) bool
- func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, ...) bool
- func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, ...) bool
- func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, ...) bool
- func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, ...) bool
- func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, ...) bool
- func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, ...) bool
- func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, ...) bool
- func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool
- func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool
- func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool
- func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool
- func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool
- func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool
- func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool
- func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool
- func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool
- func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool
- func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool
- func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool
- func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool
- func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool
- func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool
- func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, ...) bool
- func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, ...) bool
- func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool
- func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool
- type Comparison
- type ContextDiff
- type Match
- type OpCode
- type PanicTestFunc
- type SequenceMatcher
- func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode
- func (m *SequenceMatcher) GetMatchingBlocks() []Match
- func (m *SequenceMatcher) GetOpCodes() []OpCode
- func (m *SequenceMatcher) QuickRatio() float64
- func (m *SequenceMatcher) Ratio() float64
- func (m *SequenceMatcher) RealQuickRatio() float64
- func (m *SequenceMatcher) SetSeq1(a []string)
- func (m *SequenceMatcher) SetSeq2(b []string)
- func (m *SequenceMatcher) SetSeqs(a, b []string)
- type TestingT
- type UnifiedDiff
Constants ¶
This section is empty.
Variables ¶
var AnError = errors.New("assert.AnError general error for testing")
Functions ¶
func CallerInfo ¶
func CallerInfo() []string
func Condition ¶
func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool
func Conditionf ¶
func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool
func EqualError ¶
func EqualErrorf ¶
func EqualValues ¶
func EqualValuesf ¶
func GetContextDiffString ¶
func GetContextDiffString(diff ContextDiff) (string, error)
func GetUnifiedDiffString ¶
func GetUnifiedDiffString(diff UnifiedDiff) (string, error)
func HTTPBodyContains ¶
func HTTPBodyContainsf ¶
func HTTPBodyNotContains ¶
func HTTPBodyNotContainsf ¶
func HTTPErrorf ¶
func HTTPRedirect ¶
func HTTPRedirectf ¶
func HTTPSuccess ¶
func HTTPSuccessf ¶
func Implements ¶
func Implementsf ¶
func InDeltaSlice ¶
func InDeltaSlicef ¶
func InEpsilonSlice ¶
func InEpsilonSlicef ¶
func InEpsilonf ¶
func NotContains ¶
func NotContainsf ¶
func NotPanics ¶
func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool
func NotPanicsf ¶
func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool
func NotRegexpf ¶
func NotSubsetf ¶
func ObjectsAreEqual ¶
func ObjectsAreEqual(expected, actual interface{}) bool
func ObjectsAreEqualValues ¶
func ObjectsAreEqualValues(expected, actual interface{}) bool
func Panics ¶
func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool
func PanicsWithValue ¶
func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool
func PanicsWithValuef ¶
func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool
func SplitLines ¶
func WithinDuration ¶
func WithinDurationf ¶
func WriteContextDiff ¶
func WriteContextDiff(writer io.Writer, diff ContextDiff) error
func WriteUnifiedDiff ¶
func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error
Types ¶
type Assertions ¶
type Assertions struct {
// contains filtered or unexported fields
}
func New ¶
func New(t TestingT) *Assertions
func (*Assertions) Condition ¶
func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool
func (*Assertions) Conditionf ¶
func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool
func (*Assertions) Contains ¶
func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) Containsf ¶
func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool
func (*Assertions) Empty ¶
func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) Emptyf ¶
func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool
func (*Assertions) Equal ¶
func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) EqualError ¶
func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool
func (*Assertions) EqualErrorf ¶
func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool
func (*Assertions) EqualValues ¶
func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) EqualValuesf ¶
func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
func (*Assertions) Equalf ¶
func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
func (*Assertions) Error ¶
func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool
func (*Assertions) Errorf ¶
func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool
func (*Assertions) Exactly ¶
func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) Exactlyf ¶
func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
func (*Assertions) Fail ¶
func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool
func (*Assertions) FailNow ¶
func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool
func (*Assertions) FailNowf ¶
func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool
func (*Assertions) Failf ¶
func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool
func (*Assertions) False ¶
func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool
func (*Assertions) Falsef ¶
func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool
func (*Assertions) HTTPBodyContains ¶
func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool
func (*Assertions) HTTPBodyContainsf ¶
func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool
func (*Assertions) HTTPBodyNotContains ¶
func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool
func (*Assertions) HTTPBodyNotContainsf ¶
func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool
func (*Assertions) HTTPError ¶
func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) bool
func (*Assertions) HTTPErrorf ¶
func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values) bool
func (*Assertions) HTTPRedirect ¶
func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) bool
func (*Assertions) HTTPRedirectf ¶
func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values) bool
func (*Assertions) HTTPSuccess ¶
func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) bool
func (*Assertions) HTTPSuccessf ¶
func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values) bool
func (*Assertions) Implements ¶
func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) Implementsf ¶
func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool
func (*Assertions) InDelta ¶
func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool
func (*Assertions) InDeltaSlice ¶
func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool
func (*Assertions) InDeltaSlicef ¶
func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool
func (*Assertions) InDeltaf ¶
func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool
func (*Assertions) InEpsilon ¶
func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool
func (*Assertions) InEpsilonSlice ¶
func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool
func (*Assertions) InEpsilonSlicef ¶
func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool
func (*Assertions) InEpsilonf ¶
func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool
func (*Assertions) IsType ¶
func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) IsTypef ¶
func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool
func (*Assertions) JSONEq ¶
func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool
func (*Assertions) JSONEqf ¶
func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool
func (*Assertions) Len ¶
func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool
func (*Assertions) Lenf ¶
func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool
func (*Assertions) Nil ¶
func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) Nilf ¶
func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool
func (*Assertions) NoError ¶
func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool
func (*Assertions) NoErrorf ¶
func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool
func (*Assertions) NotContains ¶
func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) NotContainsf ¶
func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool
func (*Assertions) NotEmpty ¶
func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) NotEmptyf ¶
func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool
func (*Assertions) NotEqual ¶
func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) NotEqualf ¶
func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
func (*Assertions) NotNil ¶
func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) NotNilf ¶
func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool
func (*Assertions) NotPanics ¶
func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool
func (*Assertions) NotPanicsf ¶
func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool
func (*Assertions) NotRegexp ¶
func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) NotRegexpf ¶
func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool
func (*Assertions) NotSubset ¶
func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) NotSubsetf ¶
func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool
func (*Assertions) NotZero ¶
func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) NotZerof ¶
func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool
func (*Assertions) Panics ¶
func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool
func (*Assertions) PanicsWithValue ¶
func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool
func (*Assertions) PanicsWithValuef ¶
func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool
func (*Assertions) Panicsf ¶
func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool
func (*Assertions) Regexp ¶
func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) Regexpf ¶
func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool
func (*Assertions) Subset ¶
func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) Subsetf ¶
func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool
func (*Assertions) True ¶
func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool
func (*Assertions) Truef ¶
func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool
func (*Assertions) WithinDuration ¶
func (*Assertions) WithinDurationf ¶
func (*Assertions) Zero ¶
func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool
func (*Assertions) Zerof ¶
func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool
type Comparison ¶
type Comparison func() (success bool)
type ContextDiff ¶
type ContextDiff UnifiedDiff
type PanicTestFunc ¶
type PanicTestFunc func()
type SequenceMatcher ¶
func NewMatcher ¶
func NewMatcher(a, b []string) *SequenceMatcher
func NewMatcherWithJunk ¶
func NewMatcherWithJunk(a, b []string, autoJunk bool, isJunk func(string) bool) *SequenceMatcher
func (*SequenceMatcher) GetGroupedOpCodes ¶
func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode
func (*SequenceMatcher) GetMatchingBlocks ¶
func (m *SequenceMatcher) GetMatchingBlocks() []Match
func (*SequenceMatcher) GetOpCodes ¶
func (m *SequenceMatcher) GetOpCodes() []OpCode
func (*SequenceMatcher) QuickRatio ¶
func (m *SequenceMatcher) QuickRatio() float64
func (*SequenceMatcher) Ratio ¶
func (m *SequenceMatcher) Ratio() float64
func (*SequenceMatcher) RealQuickRatio ¶
func (m *SequenceMatcher) RealQuickRatio() float64
func (*SequenceMatcher) SetSeq1 ¶
func (m *SequenceMatcher) SetSeq1(a []string)
func (*SequenceMatcher) SetSeq2 ¶
func (m *SequenceMatcher) SetSeq2(b []string)
func (*SequenceMatcher) SetSeqs ¶
func (m *SequenceMatcher) SetSeqs(a, b []string)
type UnifiedDiff ¶
type UnifiedDiff struct { A []string // First sequence lines FromFile string // First file name FromDate string // First file time B []string // Second sequence lines ToFile string // Second file name ToDate string // Second file time Eol string // Headers end of line, defaults to LF Context int // Number of context lines }