(t *testing.T)
| 280 | } |
| 281 | |
| 282 | func Test_Mock_On_WithArgMatcherThatPanics(t *testing.T) { |
| 283 | t.Parallel() |
| 284 | |
| 285 | var mockedService TestExampleImplementation |
| 286 | |
| 287 | mockedService.On("TheExampleMethod2", MatchedBy(func(_ interface{}) bool { |
| 288 | panic("try to lock mockedService") |
| 289 | })).Return() |
| 290 | |
| 291 | defer func() { |
| 292 | assertedExpectations := make(chan struct{}) |
| 293 | go func() { |
| 294 | tt := new(testing.T) |
| 295 | mockedService.AssertExpectations(tt) |
| 296 | close(assertedExpectations) |
| 297 | }() |
| 298 | select { |
| 299 | case <-assertedExpectations: |
| 300 | case <-time.After(time.Second): |
| 301 | t.Fatal("AssertExpectations() deadlocked, did the panic leave mockedService locked?") |
| 302 | } |
| 303 | }() |
| 304 | |
| 305 | assert.Panics(t, func() { |
| 306 | mockedService.TheExampleMethod2(false) |
| 307 | }) |
| 308 | } |
| 309 | |
| 310 | func TestMock_WithTest(t *testing.T) { |
| 311 | t.Parallel() |
nothing calls this directly
no test coverage detected