(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestWriteTool_OverwriteExisting(t *testing.T) { |
| 60 | tool, err := NewWriteTool(nil) |
| 61 | if err != nil { |
| 62 | t.Fatalf("Failed to create Write tool: %v", err) |
| 63 | } |
| 64 | |
| 65 | helper := NewTestHelper(t) |
| 66 | defer helper.CleanupAll() |
| 67 | |
| 68 | // 先创建一个文件 |
| 69 | filePath := helper.CreateTempFile("existing.txt", "Original content") |
| 70 | |
| 71 | newContent := "Overwritten content" |
| 72 | input := map[string]any{ |
| 73 | "file_path": filePath, |
| 74 | "content": newContent, |
| 75 | } |
| 76 | |
| 77 | result := ExecuteToolWithRealFS(t, tool, input) |
| 78 | _ = AssertToolSuccess(t, result) |
| 79 | |
| 80 | // 验证文件被覆盖 |
| 81 | AssertFileContent(t, filePath, newContent) |
| 82 | } |
| 83 | |
| 84 | func TestWriteTool_AppendMode(t *testing.T) { |
| 85 | tool, err := NewWriteTool(nil) |
nothing calls this directly
no test coverage detected