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

Function TestRunPerFile_TaskDoneFailed

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

Source from the content-addressed store, hash-verified

167}
168
169func 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
191func TestRunPerFile_InvalidTaskDoneStateRetries(t *testing.T) {
192 tests := []struct {

Callers

nothing calls this directly

Calls 5

RunPerFileMethod · 0.95
NewTextMessageFunction · 0.92
NewRunnerFunction · 0.85
newTestDepsFunction · 0.85

Tested by

no test coverage detected