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

Function TestLoggingAssertExpectations

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

Source from the content-addressed store, hash-verified

2185func (tc *tCustomLogger) FailNow() {}
2186
2187func TestLoggingAssertExpectations(t *testing.T) {
2188 t.Parallel()
2189
2190 m := new(timer)
2191 m.On("GetTime", 0).Return("")
2192 tcl := &tCustomLogger{t, []string{}, []string{}}
2193
2194 AssertExpectationsForObjects(tcl, m, new(TestExampleImplementation))
2195
2196 require.Equal(t, 1, len(tcl.errs))
2197 assert.Regexp(t, regexp.MustCompile("(?s)FAIL: 0 out of 1 expectation\\(s\\) were met.*The code you are testing needs to make 1 more call\\(s\\).*"), tcl.errs[0])
2198 require.Equal(t, 2, len(tcl.logs))
2199 assert.Regexp(t, regexp.MustCompile("(?s)FAIL:\tGetTime\\(int\\).*"), tcl.logs[0])
2200 require.Equal(t, "Expectations didn't match for Mock: *mock.timer", tcl.logs[1])
2201}
2202
2203func TestAfterTotalWaitTimeWhileExecution(t *testing.T) {
2204 t.Parallel()

Callers

nothing calls this directly

Calls 5

EqualFunction · 0.92
RegexpFunction · 0.92
ReturnMethod · 0.80
OnMethod · 0.45

Tested by

no test coverage detected