mirror of https://github.com/stretchr/testify.git
failing test for #31
parent
9cc77fa253
commit
b222794f02
|
@ -29,6 +29,13 @@ func (i *TestExampleImplementation) TheExampleMethod2(yesorno bool) {
|
||||||
i.Mock.Called(yesorno)
|
i.Mock.Called(yesorno)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ExampleType struct{}
|
||||||
|
|
||||||
|
func (i *TestExampleImplementation) TheExampleMethod3(et *ExampleType) error {
|
||||||
|
args := i.Mock.Called(et)
|
||||||
|
return args.Error(0)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Mock
|
Mock
|
||||||
*/
|
*/
|
||||||
|
@ -383,6 +390,23 @@ func Test_Mock_AssertExpectations(t *testing.T) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_Mock_AssertExpectationsCustomType(t *testing.T) {
|
||||||
|
|
||||||
|
var mockedService *TestExampleImplementation = new(TestExampleImplementation)
|
||||||
|
|
||||||
|
mockedService.Mock.On("TheExampleMethod3", AnythingOfType("*mock.ExampleType")).Return(nil).Once()
|
||||||
|
|
||||||
|
tt := new(testing.T)
|
||||||
|
assert.False(t, mockedService.AssertExpectations(tt))
|
||||||
|
|
||||||
|
// make the call now
|
||||||
|
mockedService.TheExampleMethod3(&ExampleType{})
|
||||||
|
|
||||||
|
// now assert expectations
|
||||||
|
assert.True(t, mockedService.AssertExpectations(tt))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func Test_Mock_AssertExpectations_With_Repeatability(t *testing.T) {
|
func Test_Mock_AssertExpectations_With_Repeatability(t *testing.T) {
|
||||||
|
|
||||||
var mockedService *TestExampleImplementation = new(TestExampleImplementation)
|
var mockedService *TestExampleImplementation = new(TestExampleImplementation)
|
||||||
|
|
Loading…
Reference in New Issue