mirror of https://github.com/stretchr/testify.git
go fmt
parent
85763a0f23
commit
044591a481
|
@ -214,7 +214,7 @@ func Nil(t *testing.T, object interface{}, msgAndArgs ...interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// isEmpty gets whether the specified object is considered empty or not.
|
// isEmpty gets whether the specified object is considered empty or not.
|
||||||
func isEmpty(object interface{}) bool {
|
func isEmpty(object interface{}) bool {
|
||||||
|
|
||||||
if object == nil {
|
if object == nil {
|
||||||
|
@ -265,7 +265,7 @@ func Empty(t *testing.T, object interface{}, msgAndArgs ...interface{}) bool {
|
||||||
// slice with len == 0.
|
// slice with len == 0.
|
||||||
//
|
//
|
||||||
// if assert.NotEmpty(t, obj) {
|
// if assert.NotEmpty(t, obj) {
|
||||||
// assert.Equal(t, "two", obj[1])
|
// assert.Equal(t, "two", obj[1])
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// Returns whether the assertion was successful (true) or not (false).
|
// Returns whether the assertion was successful (true) or not (false).
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
// "testing"
|
// "testing"
|
||||||
// "github.com/stretchrcom/testify/assert"
|
// "github.com/stretchrcom/testify/assert"
|
||||||
// )
|
// )
|
||||||
//
|
//
|
||||||
// func TestSomething(t *testing.T) {
|
// func TestSomething(t *testing.T) {
|
||||||
//
|
//
|
||||||
// var a string = "Hello"
|
// var a string = "Hello"
|
||||||
// var b string = "Hello"
|
// var b string = "Hello"
|
||||||
//
|
//
|
||||||
|
@ -30,17 +30,17 @@
|
||||||
// Here is an overview of the assert functions:
|
// Here is an overview of the assert functions:
|
||||||
//
|
//
|
||||||
// assert.Equal(t, expected, actual [, message [, format-args])
|
// assert.Equal(t, expected, actual [, message [, format-args])
|
||||||
//
|
//
|
||||||
// assert.NotEqual(t, notExpected, actual [, message [, format-args]])
|
// assert.NotEqual(t, notExpected, actual [, message [, format-args]])
|
||||||
//
|
//
|
||||||
// assert.True(t, actualBool [, message [, format-args]])
|
// assert.True(t, actualBool [, message [, format-args]])
|
||||||
//
|
//
|
||||||
// assert.False(t, actualBool [, message [, format-args]])
|
// assert.False(t, actualBool [, message [, format-args]])
|
||||||
//
|
//
|
||||||
// assert.Nil(t, actualObject [, message [, format-args]])
|
// assert.Nil(t, actualObject [, message [, format-args]])
|
||||||
//
|
//
|
||||||
// assert.NotNil(t, actualObject [, message [, format-args]])
|
// assert.NotNil(t, actualObject [, message [, format-args]])
|
||||||
//
|
//
|
||||||
// assert.Empty(t, actualObject [, message [, format-args]])
|
// assert.Empty(t, actualObject [, message [, format-args]])
|
||||||
//
|
//
|
||||||
// assert.NotEmpty(t, actualObject [, message [, format-args]])
|
// assert.NotEmpty(t, actualObject [, message [, format-args]])
|
||||||
|
@ -52,20 +52,20 @@
|
||||||
// assert.Implements(t, (*MyInterface)(nil), new(MyObject) [,message [, format-args]])
|
// assert.Implements(t, (*MyInterface)(nil), new(MyObject) [,message [, format-args]])
|
||||||
//
|
//
|
||||||
// assert.IsType(t, expectedObject, actualObject [, message [, format-args]])
|
// assert.IsType(t, expectedObject, actualObject [, message [, format-args]])
|
||||||
//
|
//
|
||||||
// assert.Contains(t, string, substring [, message [, format-args]])
|
// assert.Contains(t, string, substring [, message [, format-args]])
|
||||||
//
|
//
|
||||||
// assert.NotContains(t, string, substring [, message [, format-args]])
|
// assert.NotContains(t, string, substring [, message [, format-args]])
|
||||||
//
|
//
|
||||||
// assert.Panics(t, func(){
|
// assert.Panics(t, func(){
|
||||||
//
|
//
|
||||||
// // call code that should panic
|
// // call code that should panic
|
||||||
//
|
//
|
||||||
// } [, message [, format-args]])
|
// } [, message [, format-args]])
|
||||||
//
|
//
|
||||||
// assert.NotPanics(t, func(){
|
// assert.NotPanics(t, func(){
|
||||||
//
|
//
|
||||||
// // call code that should not panic
|
// // call code that should not panic
|
||||||
//
|
//
|
||||||
// } [, message [, format-args]])
|
// } [, message [, format-args]])
|
||||||
package assert
|
package assert
|
||||||
|
|
10
mock/mock.go
10
mock/mock.go
|
@ -28,7 +28,7 @@ type Call struct {
|
||||||
ReturnArguments Arguments
|
ReturnArguments Arguments
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mock is the workhorse used to track activity on another object.
|
// Mock is the workhorse used to track activity on another object.
|
||||||
// For an example of its usage, refer to the "Example Usage" section at the top of this document.
|
// For an example of its usage, refer to the "Example Usage" section at the top of this document.
|
||||||
type Mock struct {
|
type Mock struct {
|
||||||
|
|
||||||
|
@ -170,11 +170,11 @@ func (m *Mock) Called(arguments ...interface{}) Arguments {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Assertions
|
Assertions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// AssertExpectationsForObjects asserts that everything specified with On and Return
|
// AssertExpectationsForObjects asserts that everything specified with On and Return
|
||||||
// of the specified objects was in fact called as expected.
|
// of the specified objects was in fact called as expected.
|
||||||
//
|
//
|
||||||
// Calls may have occurred in any order.
|
// Calls may have occurred in any order.
|
||||||
func AssertExpectationsForObjects(t *testing.T, testObjects ...interface{}) bool {
|
func AssertExpectationsForObjects(t *testing.T, testObjects ...interface{}) bool {
|
||||||
|
@ -265,7 +265,7 @@ func (m *Mock) methodWasCalled(methodName string, arguments []interface{}) bool
|
||||||
type Arguments []interface{}
|
type Arguments []interface{}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// The "any" argument. Used in Diff and Assert when
|
// The "any" argument. Used in Diff and Assert when
|
||||||
// the argument being tested shouldn't be taken into consideration.
|
// the argument being tested shouldn't be taken into consideration.
|
||||||
Anything string = "mock.Anything"
|
Anything string = "mock.Anything"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue