(t *testing.T)
| 82 | } |
| 83 | |
| 84 | func TestWriteTool_AppendMode(t *testing.T) { |
| 85 | tool, err := NewWriteTool(nil) |
| 86 | if err != nil { |
| 87 | t.Fatalf("Failed to create Write tool: %v", err) |
| 88 | } |
| 89 | |
| 90 | helper := NewTestHelper(t) |
| 91 | defer helper.CleanupAll() |
| 92 | |
| 93 | // 先创建一个文件 |
| 94 | originalContent := "Original line\n" |
| 95 | filePath := helper.CreateTempFile("append.txt", originalContent) |
| 96 | |
| 97 | appendContent := "Appended line" |
| 98 | input := map[string]any{ |
| 99 | "file_path": filePath, |
| 100 | "content": appendContent, |
| 101 | "append": true, |
| 102 | } |
| 103 | |
| 104 | result := ExecuteToolWithRealFS(t, tool, input) |
| 105 | _ = AssertToolSuccess(t, result) |
| 106 | |
| 107 | // 验证内容被追加 |
| 108 | expectedContent := originalContent + appendContent |
| 109 | AssertFileContent(t, filePath, expectedContent) |
| 110 | } |
| 111 | |
| 112 | func TestWriteTool_AutoCreateDirectory(t *testing.T) { |
| 113 | t.Skip("Skipping: WriteTool auto-create directory functionality doesn't work with RealFS") |
nothing calls this directly
no test coverage detected