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

Function TestGlobTool_RecursivePattern

pkg/tools/builtin/glob_test.go:259–290  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

257}
258
259func TestGlobTool_RecursivePattern(t *testing.T) {
260 t.Skip("Skipping: GlobTool implementation returns incorrect format for matches field")
261 tool, err := NewGlobTool(nil)
262 if err != nil {
263 t.Fatalf("Failed to create Glob tool: %v", err)
264 }
265
266 input := map[string]any{
267 "pattern": "**/*.go",
268 }
269
270 result := ExecuteToolWithInput(t, tool, input)
271 result = AssertToolSuccess(t, result)
272
273 // 验证递归搜索
274 if matches, exists := result["matches"]; !exists {
275 t.Error("Result should contain 'matches' field")
276 } else if matchesArray, ok := matches.([]string); !ok {
277 t.Error("matches should be a string array")
278 } else {
279 // 应该找到更多的文件,包括子目录中的
280 if len(matchesArray) == 0 {
281 t.Log("Warning: No .go files found, but this could be normal in test environment")
282 } else {
283 t.Logf("Found %d .go files with recursive pattern", len(matchesArray))
284 }
285 }
286
287 if recursive, exists := result["recursive"]; !exists || recursive.(bool) != true {
288 t.Error("Should indicate recursive search was performed")
289 }
290}
291
292func TestGlobTool_MissingPattern(t *testing.T) {
293 tool, err := NewGlobTool(nil)

Callers

nothing calls this directly

Calls 5

NewGlobToolFunction · 0.85
ExecuteToolWithInputFunction · 0.85
AssertToolSuccessFunction · 0.85
ErrorMethod · 0.65
LogMethod · 0.65

Tested by

no test coverage detected