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

Function TestRunPerFile_TaskDoneFailed

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

Source from the content-addressed store, hash-verified

142}
143
144func 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
166func TestRunPerFile_InvalidTaskDoneStateRetries(t *testing.T) {
167 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