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

Function Test_Mock_On_WithMixedVariadicFunc

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

Source from the content-addressed store, hash-verified

457}
458
459func 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
483func Test_Mock_On_WithVariadicFuncWithInterface(t *testing.T) {
484 t.Parallel()

Callers

nothing calls this directly

Calls 6

EqualFunction · 0.92
NotPanicsFunction · 0.92
PanicsFunction · 0.92
ReturnMethod · 0.80
OnMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…