MCPcopy Create free account
hub / github.com/alibaba/open-code-review / TestRunMainTask_TaskDoneFailed

Function TestRunMainTask_TaskDoneFailed

internal/reviewtask/loop_test.go:189–209  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

187}
188
189func TestRunMainTask_TaskDoneFailed(t *testing.T) {
190 client := &fakeClient{responses: []*llm.ChatResponse{
191 taskDoneResponseWithArguments(`{"state":"FAILED"}`),
192 }}
193 runner := NewRunner(newTestDeps(client))
194
195 completed, _, err := runner.RunMainTask(
196 context.Background(),
197 []llm.Message{llm.NewTextMessage("user", "review this file")},
198 "main.go",
199 )
200 if err == nil || !strings.Contains(err.Error(), "task_done reported FAILED") {
201 t.Fatalf("expected task_done FAILED error, got %v", err)
202 }
203 if completed {
204 t.Fatal("task_done FAILED must not complete RunMainTask")
205 }
206 if client.calls != 1 {
207 t.Fatalf("expected terminal failure after 1 LLM call, got %d", client.calls)
208 }
209}
210
211func TestRunMainTask_InvalidTaskDoneStateRetries(t *testing.T) {
212 tests := []struct {

Callers

nothing calls this directly

Calls 6

RunMainTaskMethod · 0.95
NewTextMessageFunction · 0.92
newTestDepsFunction · 0.85
NewRunnerFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected