testutils

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2021 License: Apache-2.0 Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeReturn

func MakeReturn(retArgs ...interface{}) []interface{}

MakeReturn is a test utility function useful to convert multiple return values to an array of interface{}.

Usage:  Given the following function

   SomeFunction() (int, string, bool, error) {
       return 1, "hello", true, error.New("some error")
   }

Doing the following:

   result := MakeReturn(SomeFunction())

The value of `result` will be:

    result = []interface{}{ 1, "hello", true, error.New("some error") }

Types

type WhenHandler

type WhenHandler func(args ...interface{}) []interface{}

WhenHandler is used in mocks and it is associated to a function name. If registered, when a function by a given name is triggered, all arguments received by the function will be relayed to the handler. The handler should respond as many arguments as the function has.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL