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

Function TestExcludeToolDef

cmd/opencodereview/scan_cmd_test.go:11–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestExcludeToolDef(t *testing.T) {
12 defs := []llm.ToolDef{
13 {Type: "function", Function: llm.FunctionDef{Name: "task_done"}},
14 {Type: "function", Function: llm.FunctionDef{Name: "file_read"}},
15 {Type: "function", Function: llm.FunctionDef{Name: "file_read_diff"}},
16 {Type: "function", Function: llm.FunctionDef{Name: "code_comment"}},
17 }
18 got := excludeToolDef(defs, "file_read_diff")
19 if len(got) != 3 {
20 t.Fatalf("expected 3 defs, got %d", len(got))
21 }
22 for _, d := range got {
23 if d.Function.Name == "file_read_diff" {
24 t.Errorf("file_read_diff should have been removed")
25 }
26 }
27 // Input slice must not be mutated.
28 if len(defs) != 4 {
29 t.Errorf("input slice was mutated: len=%d, want 4", len(defs))
30 }
31}
32
33func TestExcludeToolDef_AbsentName(t *testing.T) {
34 defs := []llm.ToolDef{

Callers

nothing calls this directly

Calls 1

excludeToolDefFunction · 0.85

Tested by

no test coverage detected