(t *testing.T)
| 167 | } |
| 168 | |
| 169 | func TestRunPerFile_TaskDoneFailed(t *testing.T) { |
| 170 | client := &fakeClient{responses: []*llm.ChatResponse{ |
| 171 | taskDoneResponseWithArguments(`{"state":"FAILED"}`), |
| 172 | }} |
| 173 | runner := NewRunner(newTestDeps(client)) |
| 174 | |
| 175 | completed, _, err := runner.RunPerFile( |
| 176 | context.Background(), |
| 177 | []llm.Message{llm.NewTextMessage("user", "review this file")}, |
| 178 | "main.go", |
| 179 | ) |
| 180 | if err == nil || !strings.Contains(err.Error(), "task_done reported FAILED") { |
| 181 | t.Fatalf("expected task_done FAILED error, got %v", err) |
| 182 | } |
| 183 | if completed { |
| 184 | t.Fatal("task_done FAILED must not complete RunPerFile") |
| 185 | } |
| 186 | if client.calls != 1 { |
| 187 | t.Fatalf("expected terminal failure after 1 LLM call, got %d", client.calls) |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | func TestRunPerFile_InvalidTaskDoneStateRetries(t *testing.T) { |
| 192 | tests := []struct { |
nothing calls this directly
no test coverage detected