(t *testing.T)
| 177 | } |
| 178 | |
| 179 | func TestEditTool_NonExistentFile(t *testing.T) { |
| 180 | tool, err := NewEditTool(nil) |
| 181 | if err != nil { |
| 182 | t.Fatalf("Failed to create Edit tool: %v", err) |
| 183 | } |
| 184 | |
| 185 | input := map[string]any{ |
| 186 | "file_path": "/nonexistent/file.txt", |
| 187 | "old_string": "old content", |
| 188 | "new_string": "new content", |
| 189 | } |
| 190 | |
| 191 | result := ExecuteToolWithInput(t, tool, input) |
| 192 | |
| 193 | // 应该返回文件不存在的错误 |
| 194 | errMsg := AssertToolError(t, result) |
| 195 | if !strings.Contains(strings.ToLower(errMsg), "file") && |
| 196 | !strings.Contains(strings.ToLower(errMsg), "not found") && |
| 197 | !strings.Contains(strings.ToLower(errMsg), "no such file") { |
| 198 | t.Errorf("Expected file not found error, got: %s", errMsg) |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | func TestEditTool_SameString(t *testing.T) { |
| 203 | if testing.Short() { |
nothing calls this directly
no test coverage detected