MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_glob_recursive

Function test_glob_recursive

core/src/tools/builtin/glob_tool.rs:145–163  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143
144 #[tokio::test]
145 async fn test_glob_recursive() {
146 let temp = tempfile::tempdir().unwrap();
147 let sub = temp.path().join("sub");
148 std::fs::create_dir(&sub).unwrap();
149 std::fs::write(temp.path().join("root.rs"), "").unwrap();
150 std::fs::write(sub.join("nested.rs"), "").unwrap();
151
152 let tool = GlobTool;
153 let ctx = ToolContext::new(temp.path().to_path_buf());
154
155 let result = tool
156 .execute(&serde_json::json!({"pattern": "**/*.rs"}), &ctx)
157 .await
158 .unwrap();
159
160 assert!(result.success);
161 assert!(result.content.contains("root.rs"));
162 assert!(result.content.contains("nested.rs"));
163 }
164
165 #[tokio::test]
166 async fn test_glob_missing_pattern() {

Callers

nothing calls this directly

Calls 3

writeFunction · 0.85
pathMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected