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

Function Test_Mock_On_WithVariadicFunc

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

Source from the content-addressed store, hash-verified

434}
435
436func 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
459func Test_Mock_On_WithMixedVariadicFunc(t *testing.T) {
460 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…