(b *testing.B)
| 138 | } |
| 139 | |
| 140 | func BenchmarkWriteTool_SmallFile(b *testing.B) { |
| 141 | tool, err := NewWriteTool(nil) |
| 142 | if err != nil { |
| 143 | b.Fatalf("Failed to create Write tool: %v", err) |
| 144 | } |
| 145 | |
| 146 | helper := NewTestHelper(&testing.T{}) |
| 147 | defer helper.CleanupAll() |
| 148 | |
| 149 | filePath := helper.TmpDir + "/benchmark.txt" |
| 150 | content := "Benchmark content" |
| 151 | |
| 152 | input := map[string]any{ |
| 153 | "file_path": filePath, |
| 154 | "content": content, |
| 155 | } |
| 156 | |
| 157 | // 清理文件 |
| 158 | defer func() { |
| 159 | if err := os.Remove(filePath); err != nil { |
| 160 | b.Errorf("Failed to remove file: %v", err) |
| 161 | } |
| 162 | }() |
| 163 | |
| 164 | BenchmarkTool(b, tool, input) |
| 165 | } |
nothing calls this directly
no test coverage detected