(t *testing.T)
| 2171 | } |
| 2172 | |
| 2173 | func TestComplete(t *testing.T) { |
| 2174 | completionValues := []string{"python", "pytorch", "pyside"} |
| 2175 | |
| 2176 | serverOpts := &ServerOptions{ |
| 2177 | CompletionHandler: func(_ context.Context, request *CompleteRequest) (*CompleteResult, error) { |
| 2178 | return &CompleteResult{ |
| 2179 | Completion: CompletionResultDetails{ |
| 2180 | Values: completionValues, |
| 2181 | }, |
| 2182 | }, nil |
| 2183 | }, |
| 2184 | } |
| 2185 | server := NewServer(testImpl, serverOpts) |
| 2186 | cs, _, cleanup := basicClientServerConnection(t, nil, server, func(s *Server) {}) |
| 2187 | defer cleanup() |
| 2188 | |
| 2189 | result, err := cs.Complete(context.Background(), &CompleteParams{ |
| 2190 | Argument: CompleteParamsArgument{ |
| 2191 | Name: "language", |
| 2192 | Value: "py", |
| 2193 | }, |
| 2194 | Ref: &CompleteReference{ |
| 2195 | Type: "ref/prompt", |
| 2196 | Name: "code_review", |
| 2197 | }, |
| 2198 | }) |
| 2199 | if err != nil { |
| 2200 | t.Fatal(err) |
| 2201 | } |
| 2202 | |
| 2203 | if diff := cmp.Diff(completionValues, result.Completion.Values); diff != "" { |
| 2204 | t.Errorf("Complete() mismatch (-want +got):\n%s", diff) |
| 2205 | } |
| 2206 | } |
| 2207 | |
| 2208 | // TestEmbeddedStructResponse performs a tool call to verify that a struct with |
| 2209 | // an embedded pointer generates a correct, flattened JSON schema and that its |
nothing calls this directly
no test coverage detected
searching dependent graphs…