| 434 | } |
| 435 | |
| 436 | func Test_Mock_On_WithVariadicFunc(t *testing.T) { |
| 437 | t.Parallel() |
| 438 | |
| 439 | // make a test impl object |
| 440 | var mockedService = new(TestExampleImplementation) |
| 441 | |
| 442 | c := mockedService. |
| 443 | On("TheExampleMethodVariadic", []int{1, 2, 3}). |
| 444 | Return(nil) |
| 445 | |
| 446 | assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls) |
| 447 | assert.Equal(t, 1, len(c.Arguments)) |
| 448 | assert.Equal(t, []int{1, 2, 3}, c.Arguments[0]) |
| 449 | |
| 450 | assert.NotPanics(t, func() { |
| 451 | mockedService.TheExampleMethodVariadic(1, 2, 3) |
| 452 | }) |
| 453 | assert.Panics(t, func() { |
| 454 | mockedService.TheExampleMethodVariadic(1, 2) |
| 455 | }) |
| 456 | |
| 457 | } |
| 458 | |
| 459 | func Test_Mock_On_WithMixedVariadicFunc(t *testing.T) { |
| 460 | t.Parallel() |