invocationtest

package
v0.0.0-...-fc0d1eb Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2025 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package invocationtest provides test-doubles for the invocation package

Index

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

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.

Jump to

Keyboard shortcuts

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