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

Function TestWriteTool_AppendMode

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

Source from the content-addressed store, hash-verified

82}
83
84func 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
112func TestWriteTool_AutoCreateDirectory(t *testing.T) {
113 t.Skip("Skipping: WriteTool auto-create directory functionality doesn't work with RealFS")

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected