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

Function TestReLocateComment_LLMError

internal/diff/relocation_test.go:156–176  ·  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, msgs := ReLocateComment(context.Background(), &cm, d, client, 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 if len(msgs) == 0 {
174 t.Fatal("expected non-empty messages even on error")
175 }
176}
177
178func TestReLocateComment_NilTask(t *testing.T) {
179 cm := model.LlmComment{

Callers

nothing calls this directly

Calls 3

makeDiffFunction · 0.85
ReLocateCommentFunction · 0.85
makeTaskFunction · 0.85

Tested by

no test coverage detected