tasktest

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run added in v0.60.1

func Run[T any](t testing.TB, ctx context.Context, task coretask.Task[T], inputs ...InputValue) (T, error)

Run validates inputs against the inputs declared by task and runs the task with them. It fails t when a required input is missing, when a value is given for an undeclared or ordering-only input, when the same input is given twice, or when a value cannot be read as the declared input type. Optional inputs read (zero, false) and tag inputs read an empty slice when no value is given. An input declared with coretask.UseOptional is required when the Binder merged it into a required input.

func RunTaskWithDependency

func RunTaskWithDependency[T any](baseContext context.Context, mainTask coretask.Task[T], dependencies []coretask.UntypedTask, interceptors ...coretask.Interceptor) (T, error)

RunTaskWithDependency runs a task as a graph. Supply the dependencies of the main task to resolve the graph correctly.

Types

type InputValue added in v0.60.1

type InputValue interface {
	// contains filtered or unexported methods
}

InputValue is a value that Run gives to one input of the task under test. Create it with Given or GivenTag.

func Given added in v0.60.1

func Given[T any](ref taskid.TaskReference[T], value T) InputValue

Given returns an InputValue that supplies value to the input declared with ref. Use it for inputs declared with coretask.Use or coretask.UseOptional.

func GivenTag added in v0.60.1

func GivenTag[T any](ref coretask.TagReference[T], values ...T) InputValue

GivenTag returns an InputValue that supplies values as the results of the producers of the tag referenced by ref. Use it for inputs declared with coretask.UseTag. The task reads the values in the given order.

Jump to

Keyboard shortcuts

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