MCPcopy
hub / github.com/stretchr/testify / Test_Mock_AssertExpectations_With_Pointers

Function Test_Mock_AssertExpectations_With_Pointers

mock/mock_test.go:1554–1574  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1552}
1553
1554func Test_Mock_AssertExpectations_With_Pointers(t *testing.T) {
1555 t.Parallel()
1556
1557 var mockedService = new(TestExampleImplementation)
1558
1559 mockedService.On("Test_Mock_AssertExpectations_With_Pointers", &struct{ Foo int }{1}).Return(1)
1560 mockedService.On("Test_Mock_AssertExpectations_With_Pointers", &struct{ Foo int }{2}).Return(2)
1561
1562 tt := new(testing.T)
1563 assert.False(t, mockedService.AssertExpectations(tt))
1564
1565 s := struct{ Foo int }{1}
1566 // make the calls now
1567 mockedService.Called(&s)
1568 s.Foo = 2
1569 mockedService.Called(&s)
1570
1571 // now assert expectations
1572 assert.True(t, mockedService.AssertExpectations(tt))
1573
1574}
1575
1576func Test_Mock_AssertExpectationsCustomType(t *testing.T) {
1577 t.Parallel()

Callers

nothing calls this directly

Calls 6

FalseFunction · 0.92
TrueFunction · 0.92
ReturnMethod · 0.80
CalledMethod · 0.80
AssertExpectationsMethod · 0.65
OnMethod · 0.45

Tested by

no test coverage detected