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

Function TestReLocateComment_LLMError

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

Source from the content-addressed store, hash-verified

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