(path string)
| 57 | } |
| 58 | |
| 59 | func codeCommentResponse(path string) *llm.ChatResponse { |
| 60 | content := "" |
| 61 | args := map[string]any{ |
| 62 | "path": path, |
| 63 | "comments": []any{ |
| 64 | map[string]any{ |
| 65 | "content": "potential null pointer", |
| 66 | "existing_code": "foo := bar.Baz()", |
| 67 | }, |
| 68 | }, |
| 69 | } |
| 70 | argsJSON, _ := json.Marshal(args) |
| 71 | return &llm.ChatResponse{ |
| 72 | Choices: []llm.Choice{{ |
| 73 | Message: llm.ResponseMessage{ |
| 74 | Content: &content, |
| 75 | ToolCalls: []llm.ToolCall{{ |
| 76 | ID: "call_comment", |
| 77 | Type: "function", |
| 78 | Function: llm.FunctionCall{ |
| 79 | Name: "code_comment", |
| 80 | Arguments: string(argsJSON), |
| 81 | }, |
| 82 | }}, |
| 83 | }, |
| 84 | }}, |
| 85 | Model: "fake", |
| 86 | Usage: &llm.UsageInfo{PromptTokens: 50, CompletionTokens: 20}, |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | func TestBuildFilterCommentsJSON(t *testing.T) { |
| 91 | tests := []struct { |
no outgoing calls
no test coverage detected