(t *testing.T)
| 110 | } |
| 111 | |
| 112 | func TestWriteTool_AutoCreateDirectory(t *testing.T) { |
| 113 | t.Skip("Skipping: WriteTool auto-create directory functionality doesn't work with RealFS") |
| 114 | |
| 115 | tool, err := NewWriteTool(nil) |
| 116 | if err != nil { |
| 117 | t.Fatalf("Failed to create Write tool: %v", err) |
| 118 | } |
| 119 | |
| 120 | helper := NewTestHelper(t) |
| 121 | defer helper.CleanupAll() |
| 122 | |
| 123 | // 使用不存在的目录 |
| 124 | filePath := helper.TmpDir + "/new/subdir/file.txt" |
| 125 | content := "Content in auto-created directory" |
| 126 | |
| 127 | input := map[string]any{ |
| 128 | "file_path": filePath, |
| 129 | "content": content, |
| 130 | } |
| 131 | |
| 132 | result := ExecuteToolWithRealFS(t, tool, input) |
| 133 | _ = AssertToolSuccess(t, result) |
| 134 | |
| 135 | // 验证目录和文件都被创建 |
| 136 | AssertFileExists(t, filePath) |
| 137 | AssertFileContent(t, filePath, content) |
| 138 | } |
| 139 | |
| 140 | func BenchmarkWriteTool_SmallFile(b *testing.B) { |
| 141 | tool, err := NewWriteTool(nil) |
nothing calls this directly
no test coverage detected