(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func 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 | |
| 33 | func TestExcludeToolDef_AbsentName(t *testing.T) { |
| 34 | defs := []llm.ToolDef{ |
nothing calls this directly
no test coverage detected