(t *testing.T)
| 142 | } |
| 143 | |
| 144 | func TestRunPerFile_TaskDoneFailed(t *testing.T) { |
| 145 | client := &fakeClient{responses: []*llm.ChatResponse{ |
| 146 | taskDoneResponseWithArguments(`{"state":"FAILED"}`), |
| 147 | }} |
| 148 | runner := NewRunner(newTestDeps(client)) |
| 149 | |
| 150 | completed, _, err := runner.RunPerFile( |
| 151 | context.Background(), |
| 152 | []llm.Message{llm.NewTextMessage("user", "review this file")}, |
| 153 | "main.go", |
| 154 | ) |
| 155 | if err == nil || !strings.Contains(err.Error(), "task_done reported FAILED") { |
| 156 | t.Fatalf("expected task_done FAILED error, got %v", err) |
| 157 | } |
| 158 | if completed { |
| 159 | t.Fatal("task_done FAILED must not complete RunPerFile") |
| 160 | } |
| 161 | if client.calls != 1 { |
| 162 | t.Fatalf("expected terminal failure after 1 LLM call, got %d", client.calls) |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | func TestRunPerFile_InvalidTaskDoneStateRetries(t *testing.T) { |
| 167 | tests := []struct { |
nothing calls this directly
no test coverage detected