| 457 | } |
| 458 | |
| 459 | func Test_Mock_On_WithMixedVariadicFunc(t *testing.T) { |
| 460 | t.Parallel() |
| 461 | |
| 462 | // make a test impl object |
| 463 | var mockedService = new(TestExampleImplementation) |
| 464 | |
| 465 | c := mockedService. |
| 466 | On("TheExampleMethodMixedVariadic", 1, []int{2, 3, 4}). |
| 467 | Return(nil) |
| 468 | |
| 469 | assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls) |
| 470 | assert.Equal(t, 2, len(c.Arguments)) |
| 471 | assert.Equal(t, 1, c.Arguments[0]) |
| 472 | assert.Equal(t, []int{2, 3, 4}, c.Arguments[1]) |
| 473 | |
| 474 | assert.NotPanics(t, func() { |
| 475 | mockedService.TheExampleMethodMixedVariadic(1, 2, 3, 4) |
| 476 | }) |
| 477 | assert.Panics(t, func() { |
| 478 | mockedService.TheExampleMethodMixedVariadic(1, 2, 3, 5) |
| 479 | }) |
| 480 | |
| 481 | } |
| 482 | |
| 483 | func Test_Mock_On_WithVariadicFuncWithInterface(t *testing.T) { |
| 484 | t.Parallel() |