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