exprtest

package
v0.0.0-...-5b88717 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package exprtest provides some useful test dummies to make it easier to mock expressions to return a desired result.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockExpression

type MockExpression struct {
	Eval func(*expr.Context, system.Collection) (system.Collection, error)
}

MockExpression is a test double expression that calls the contained function when evaluated.

func Error

func Error(input error) *MockExpression

Error creates a MockExpression that returns the provided error when evaluated.

func Return

func Return(out ...any) *MockExpression

Return creates a MockExpression that returns the provided inputs when evaluated.

func (*MockExpression) Evaluate

func (e *MockExpression) Evaluate(ctx *expr.Context, input system.Collection) (system.Collection, error)

Evaluate calls the contained Eval function.

Jump to

Keyboard shortcuts

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