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

Function TestReLocateComment_LLMError

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

Source from the content-addressed store, hash-verified

153}
154
155func TestReLocateComment_LLMError(t *testing.T) {
156 cm := model.LlmComment{
157 Path: "main.go",
158 Content: "test",
159 ExistingCode: "bad code",
160 }
161 d := makeDiff()
162
163 client := &mockLLMClient{err: errors.New("network error")}
164
165 ok, resp, msgs := ReLocateComment(context.Background(), &cm, d, client, makeTask(), "test-model", 1000)
166 if ok {
167 t.Fatal("expected false on LLM error")
168 }
169 if resp != nil {
170 t.Fatal("expected nil response on error")
171 }
172 if len(msgs) == 0 {
173 t.Fatal("expected non-empty messages even on error")
174 }
175}
176
177func TestReLocateComment_NilTask(t *testing.T) {
178 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