MCPcopy Create free account
hub / github.com/astercloud/aster / TestWriteTool_AutoCreateDirectory

Function TestWriteTool_AutoCreateDirectory

pkg/tools/builtin/write_test.go:112–138  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

110}
111
112func 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
140func BenchmarkWriteTool_SmallFile(b *testing.B) {
141 tool, err := NewWriteTool(nil)

Callers

nothing calls this directly

Calls 7

CleanupAllMethod · 0.95
NewWriteToolFunction · 0.85
NewTestHelperFunction · 0.85
ExecuteToolWithRealFSFunction · 0.85
AssertToolSuccessFunction · 0.85
AssertFileExistsFunction · 0.85
AssertFileContentFunction · 0.85

Tested by

no test coverage detected