(t *testing.T)
| 200 | } |
| 201 | |
| 202 | func TestEditTool_SameString(t *testing.T) { |
| 203 | if testing.Short() { |
| 204 | t.Skip("Skipping file modification test in short mode") |
| 205 | } |
| 206 | |
| 207 | tool, err := NewEditTool(nil) |
| 208 | if err != nil { |
| 209 | t.Fatalf("Failed to create Edit tool: %v", err) |
| 210 | } |
| 211 | |
| 212 | // 创建测试文件 |
| 213 | helper := NewTestHelper(t) |
| 214 | testFile := helper.CreateTempFile("test.txt", "Hello World") |
| 215 | defer helper.CleanupAll() |
| 216 | |
| 217 | input := map[string]any{ |
| 218 | "file_path": testFile, |
| 219 | "old_string": "Hello World", |
| 220 | "new_string": "Hello World", // 相同的内容 |
| 221 | } |
| 222 | |
| 223 | result := ExecuteToolWithRealFS(t, tool, input) |
| 224 | result = AssertToolSuccess(t, result) |
| 225 | |
| 226 | // 应该显示没有修改 |
| 227 | if changes, exists := result["changes_made"]; !exists || changes.(int) != 0 { |
| 228 | t.Error("Should indicate 0 changes were made") |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | func BenchmarkEditTool_SimpleEdit(b *testing.B) { |
| 233 | if testing.Short() { |
nothing calls this directly
no test coverage detected