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.