| 1278 | } |
| 1279 | |
| 1280 | func Test_Mock_findExpectedCall_Respects_Repeatability(t *testing.T) { |
| 1281 | t.Parallel() |
| 1282 | |
| 1283 | m := new(Mock) |
| 1284 | m.On("One", 1).Return("one") |
| 1285 | m.On("Two", 2).Return("two").Once() |
| 1286 | m.On("Two", 3).Return("three").Twice() |
| 1287 | m.On("Two", 3).Return("three").Times(8) |
| 1288 | |
| 1289 | f, c := m.findExpectedCall("Two", 3) |
| 1290 | |
| 1291 | if assert.Equal(t, 2, f) { |
| 1292 | if assert.NotNil(t, c) { |
| 1293 | assert.Equal(t, "Two", c.Method) |
| 1294 | assert.Equal(t, 3, c.Arguments[0]) |
| 1295 | assert.Equal(t, "three", c.ReturnArguments[0]) |
| 1296 | } |
| 1297 | } |
| 1298 | |
| 1299 | c = m.On("Once", 1).Return("one").Once() |
| 1300 | c.Repeatability = -1 |
| 1301 | f, c = m.findExpectedCall("Once", 1) |
| 1302 | if assert.Equal(t, -1, f) { |
| 1303 | if assert.NotNil(t, c) { |
| 1304 | assert.Equal(t, "Once", c.Method) |
| 1305 | assert.Equal(t, 1, c.Arguments[0]) |
| 1306 | assert.Equal(t, "one", c.ReturnArguments[0]) |
| 1307 | } |
| 1308 | } |
| 1309 | } |
| 1310 | |
| 1311 | func Test_callString(t *testing.T) { |
| 1312 | t.Parallel() |