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

Function Test_Mock_On_WithVariadicFuncWithEmptyInterfaceArray

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

Source from the content-addressed store, hash-verified

503}
504
505func Test_Mock_On_WithVariadicFuncWithEmptyInterfaceArray(t *testing.T) {
506 t.Parallel()
507
508 // make a test impl object
509 var mockedService = new(TestExampleImplementation)
510
511 var expected []interface{}
512 c := mockedService.
513 On("TheExampleMethodVariadicInterface", expected).
514 Return(nil)
515
516 assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)
517 assert.Equal(t, 1, len(c.Arguments))
518 assert.Equal(t, expected, c.Arguments[0])
519
520 assert.NotPanics(t, func() {
521 mockedService.TheExampleMethodVariadicInterface()
522 })
523 assert.Panics(t, func() {
524 mockedService.TheExampleMethodVariadicInterface(1, 2)
525 })
526
527}
528
529func Test_Mock_On_WithFuncPanics(t *testing.T) {
530 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…