MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestAutoExecAppendsInjection

Function TestAutoExecAppendsInjection

internal/app/auto_test.go:126–148  ·  view source on GitHub ↗

TestAutoExecAppendsInjection: cmdAutoExec, given a --with instruction, appends the marker + instruction to the prompt it hands to claude.

(t *testing.T)

Source from the content-addressed store, hash-verified

124// TestAutoExecAppendsInjection: cmdAutoExec, given a --with instruction,
125// appends the marker + instruction to the prompt it hands to claude.
126func TestAutoExecAppendsInjection(t *testing.T) {
127 setupFlowRoot(t)
128 seedTask(t, "auto-task")
129 seedRunningAuto(t, "auto-task", 4242)
130
131 var gotOpts harness.LaunchOpts
132 stubAutoRunner(t, func(h harness.Harness, sessionID, prompt string, opts harness.LaunchOpts) error {
133 gotOpts = opts
134 return nil
135 })
136
137 if rc := cmdAutoExec([]string{"auto-task", "--with", "extra instruction here"}); rc != 0 {
138 t.Fatalf("cmdAutoExec rc=%d, want 0", rc)
139 }
140 // The instruction is threaded via opts.Inject; the harness's
141 // AutoRunArgv wraps it behind InjectionMarker (covered in claude_test).
142 if gotOpts.Inject != "extra instruction here" {
143 t.Errorf("opts.Inject = %q, want the --with text", gotOpts.Inject)
144 }
145 if !gotOpts.SkipPermissions {
146 t.Errorf("auto runs must set SkipPermissions")
147 }
148}
149
150// TestCmdDoAutoRefusesWhenAlreadyRunning: a second --auto launch while a
151// prior run is still 'running' (live pid) is refused without --force.

Callers

nothing calls this directly

Calls 5

setupFlowRootFunction · 0.85
seedTaskFunction · 0.85
seedRunningAutoFunction · 0.85
stubAutoRunnerFunction · 0.85
cmdAutoExecFunction · 0.85

Tested by

no test coverage detected