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

Function Test_MockMethodCalled_Panic

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

Source from the content-addressed store, hash-verified

2122}
2123
2124func Test_MockMethodCalled_Panic(t *testing.T) {
2125 t.Parallel()
2126
2127 m := new(Mock)
2128 m.On("foo", "hello").Panic("world panics")
2129
2130 require.PanicsWithValue(t, "world panics", func() { m.MethodCalled("foo", "hello") })
2131 m.AssertExpectations(t)
2132}
2133
2134// Test to validate fix for racy concurrent call access in MethodCalled()
2135func Test_MockReturnAndCalledConcurrent(t *testing.T) {

Callers

nothing calls this directly

Calls 5

PanicsWithValueFunction · 0.92
PanicMethod · 0.80
MethodCalledMethod · 0.80
AssertExpectationsMethod · 0.65
OnMethod · 0.45

Tested by

no test coverage detected