(t *testing.T)
| 291 | } |
| 292 | |
| 293 | func TestMaxIterationsSafetyCapJSONMode(t *testing.T) { |
| 294 | t.Parallel() |
| 295 | |
| 296 | events := make([]runtime.Event, maxAutoExtensions+1) |
| 297 | for i := range events { |
| 298 | events[i] = maxIterEvent(60 + i*10) |
| 299 | } |
| 300 | |
| 301 | rt := &mockRuntime{events: events} |
| 302 | |
| 303 | var buf bytes.Buffer |
| 304 | out := NewPrinter(&buf) |
| 305 | sess := session.New() |
| 306 | cfg := Config{AutoApprove: true, OutputJSON: true} |
| 307 | |
| 308 | err := Run(t.Context(), out, cfg, rt, sess, []string{"hello"}) |
| 309 | assert.NilError(t, err) |
| 310 | |
| 311 | resumes := rt.getResumes() |
| 312 | assert.Equal(t, len(resumes), maxAutoExtensions+1) |
| 313 | |
| 314 | for i := range maxAutoExtensions { |
| 315 | assert.Equal(t, resumes[i].Type, runtime.ResumeTypeApprove) |
| 316 | } |
| 317 | assert.Equal(t, resumes[maxAutoExtensions].Type, runtime.ResumeTypeReject) |
| 318 | } |
| 319 | |
| 320 | // TestPrepareUserMessage_AgentSwitching tests that PrepareUserMessage correctly |
| 321 | // handles agent-switching commands and returns empty messages on switch failures. |
nothing calls this directly
no test coverage detected