MCPcopy
hub / github.com/go-task/task / NewExecutorTest

Function NewExecutorTest

executor_test.go:46–73  ·  view source on GitHub ↗

NewExecutorTest sets up a new [task.Executor] with the given options and runs a task with the given [ExecutorTestOption]s. The output of the task is written to a set of fixture files depending on the configuration of the test.

(t *testing.T, opts ...ExecutorTestOption)

Source from the content-addressed store, hash-verified

44// a task with the given [ExecutorTestOption]s. The output of the task is
45// written to a set of fixture files depending on the configuration of the test.
46func NewExecutorTest(t *testing.T, opts ...ExecutorTestOption) {
47 t.Helper()
48 tt := &ExecutorTest{
49 task: "default",
50 vars: map[string]any{},
51 TaskTest: TaskTest{
52 experiments: map[*experiments.Experiment]int{},
53 fixtureTemplateData: map[string]any{},
54 },
55 }
56 // Apply the functional options
57 for _, opt := range opts {
58 opt.applyToExecutorTest(tt)
59 }
60 // Enable any experiments that have been set
61 for x, v := range tt.experiments {
62 prev := *x
63 *x = experiments.Experiment{
64 Name: prev.Name,
65 AllowedValues: []int{v},
66 Value: v,
67 }
68 t.Cleanup(func() {
69 *x = prev
70 })
71 }
72 tt.run(t)
73}
74
75// Functional options
76

Callers 15

TestEmptyTaskFunction · 0.85
TestEmptyTaskfileFunction · 0.85
TestEnvFunction · 0.85
TestVarsFunction · 0.85
TestSecretVarsFunction · 0.85
TestRequiresFunction · 0.85
TestSpecialVarsFunction · 0.85
TestConcurrencyFunction · 0.85
TestParamsFunction · 0.85
TestDepsFunction · 0.85
TestStatusFunction · 0.85
TestPreconditionFunction · 0.85

Calls 2

runMethod · 0.95
applyToExecutorTestMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…