actiontest

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package actiontest helps the tests of the built-in actions keep what each declares of itself to what it does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFields

func CheckFields(t testing.TB, req, res []string, with, ret map[string]any)

CheckFields fails t when ret, what an action returned for a step, has a field of req or of res that req and res, the fields the action declares, leave out. with is the step's with, whose keys are fields too of an action that returns what it is given, or nil for one that does not.

func CheckRequired

func CheckRequired(t testing.TB, required [][]string, with map[string]any, run func(with map[string]any) error)

CheckRequired fails t unless run, given with without the keys of each group of required, fails for a want of one of them, before it does anything: its error names the key. with holds a key of every group, so that it is the missing one the action fails for.

Types

type Kinds

type Kinds struct {
	// contains filtered or unexported fields
}

Kinds checks that the fields of the req and the res an action returns are of the kinds it declares, as the runner receives them: after they have been sent from the action's process, which sends a time.Duration as text and every number as one kind. A field that is nil, as one an action leaves empty may be, is of any kind.

func NewKinds

func NewKinds(t testing.TB, req, res map[string]string) *Kinds

NewKinds returns a Kinds that checks what an action returns against req and res, the kinds of the fields of its req and res it declares.

func (*Kinds) Check

func (k *Kinds) Check(ret map[string]any)

Check fails the test when a field of ret, what the action returned for a step, is of another kind than the one declared for it.

func (*Kinds) Covered

func (k *Kinds) Covered()

Covered fails the test for a field declared that no result checked had a value of, as its kind is then not known to be right.

Jump to

Keyboard shortcuts

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