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

Function TestReLocateComment_LLMError

internal/diff/relocation_test.go:156–173  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

154}
155
156func TestReLocateComment_LLMError(t *testing.T) {
157 cm := model.LlmComment{
158 Path: "main.go",
159 Content: "test",
160 ExistingCode: "bad code",
161 }
162 d := makeDiff()
163
164 client := &mockLLMClient{err: errors.New("network error")}
165
166 ok, resp := ReLocateComment(context.Background(), &cm, d, client, BuildReLocationMessages(&cm, d, makeTask()), "test-model", 1000)
167 if ok {
168 t.Fatal("expected false on LLM error")
169 }
170 if resp != nil {
171 t.Fatal("expected nil response on error")
172 }
173}
174
175// TestBuildReLocationMessages_Rendering pins what the split moved out of
176// ReLocateComment: the prompt the model receives, byte for byte. Splitting the

Callers

nothing calls this directly

Calls 4

makeDiffFunction · 0.85
ReLocateCommentFunction · 0.85
BuildReLocationMessagesFunction · 0.85
makeTaskFunction · 0.85

Tested by

no test coverage detected