Documentation
¶
Overview ¶
Package invocationtest provides test-doubles for the invocation package
Index ¶
- type FakeParameter
- func Bool(b bool) *FakeParameter
- func Bools(b ...bool) *FakeParameter
- func Error(err error) *FakeParameter
- func Float[T constraints.Float](f T) *FakeParameter
- func Floats[T constraints.Float](f ...T) *FakeParameter
- func Int[T constraints.Integer](i T) *FakeParameter
- func Ints[T constraints.Integer](n ...T) *FakeParameter
- func NewParameter() *FakeParameter
- func Node[T yamlconv.Primitive](v T) *FakeParameter
- func Nodes[T yamlconv.Primitive](v ...T) *FakeParameter
- func Number[T constraints.Integer | constraints.Float](n T) *FakeParameter
- func Numbers[T constraints.Integer | constraints.Float](n ...T) *FakeParameter
- func Sequence(nodes ...*yaml.Node) *FakeParameter
- func String(s string) *FakeParameter
- func Strings(s ...string) *FakeParameter
- func SuccessParameter(nodes ...*yaml.Node) *FakeParameter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeParameter ¶
type FakeParameter struct {
// contains filtered or unexported fields
}
FakeParameter is a fake parameter that can be used in tests. This implements the invocation.Parameter interface.
func Bool ¶
func Bool(b bool) *FakeParameter
Bool creates a new FakeParameter that returns the given boolean value.
func Bools ¶
func Bools(b ...bool) *FakeParameter
Bools creates a new FakeParameter that returns the given boolean values as a collection of nodes.
func Error ¶
func Error(err error) *FakeParameter
Error creates a new FakeParameter that always returns an error.
func Float ¶
func Float[T constraints.Float](f T) *FakeParameter
Float creates a new FakeParameter that returns the given float value.
func Floats ¶
func Floats[T constraints.Float](f ...T) *FakeParameter
Floats creates a new FakeParameter that returns the given float values as a collection of nodes.
func Int ¶
func Int[T constraints.Integer](i T) *FakeParameter
Int creates a new FakeParameter that returns the given integer value.
func Ints ¶
func Ints[T constraints.Integer](n ...T) *FakeParameter
Ints creates a new FakeParameter that returns the given integer values as a collection of nodes.
func NewParameter ¶
func NewParameter() *FakeParameter
NewParameter creates a new FakeParameter with the given function behavior.
func Node ¶
func Node[T yamlconv.Primitive](v T) *FakeParameter
Node creates a new FakeParameter that returns the given node value.
func Nodes ¶
func Nodes[T yamlconv.Primitive](v ...T) *FakeParameter
Nodes creates a new FakeParameter that returns the given primitive values as a collection of nodes.
func Number ¶
func Number[T constraints.Integer | constraints.Float](n T) *FakeParameter
Number creates a new FakeParameter that returns the given number value.
func Numbers ¶
func Numbers[T constraints.Integer | constraints.Float](n ...T) *FakeParameter
Numbers creates a new FakeParameter that returns the given number values as a collection of nodes.
func Sequence ¶
func Sequence(nodes ...*yaml.Node) *FakeParameter
Sequence creates a new FakeParameter that returns a YAML sequence node
func String ¶
func String(s string) *FakeParameter
String creates a new FakeParameter that returns the given string value.
func Strings ¶
func Strings(s ...string) *FakeParameter
Strings creates a new FakeParameter that returns the given string values as a collection of nodes.
func SuccessParameter ¶
func SuccessParameter(nodes ...*yaml.Node) *FakeParameter
SuccessParameter creates a new FakeParameter that returns the given nodes.
func (*FakeParameter) AddError ¶
func (fp *FakeParameter) AddError(err error) *FakeParameter
AddError sets up the parameter to return an error value on the next available invocation.
func (*FakeParameter) AddSuccess ¶
func (fp *FakeParameter) AddSuccess(nodes ...*yaml.Node) *FakeParameter
AddSuccess sets up the parameter to return a successful value on the next available invocation.
func (*FakeParameter) GetArg ¶
func (fp *FakeParameter) GetArg(ctx invocation.Context) ([]*yaml.Node, error)
GetArg returns the value of this parameter given the context.