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

Function TestEditTool_MissingString

pkg/tools/builtin/edit_test.go:158–177  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

156}
157
158func TestEditTool_MissingString(t *testing.T) {
159 tool, err := NewEditTool(nil)
160 if err != nil {
161 t.Fatalf("Failed to create Edit tool: %v", err)
162 }
163
164 input := map[string]any{
165 "file_path": "/tmp/test.txt",
166 // 缺少 old_string
167 "new_string": "new content",
168 }
169
170 result := ExecuteToolWithInput(t, tool, input)
171
172 // 应该返回错误
173 errMsg := AssertToolError(t, result)
174 if !strings.Contains(strings.ToLower(errMsg), "required") {
175 t.Errorf("Expected required field error, got: %s", errMsg)
176 }
177}
178
179func TestEditTool_NonExistentFile(t *testing.T) {
180 tool, err := NewEditTool(nil)

Callers

nothing calls this directly

Calls 3

NewEditToolFunction · 0.85
ExecuteToolWithInputFunction · 0.85
AssertToolErrorFunction · 0.85

Tested by

no test coverage detected