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

Function test_ls_directory

core/src/tools/builtin/ls.rs:111–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109
110 #[tokio::test]
111 async fn test_ls_directory() {
112 let temp = tempfile::tempdir().unwrap();
113 std::fs::write(temp.path().join("file.txt"), "content").unwrap();
114 std::fs::create_dir(temp.path().join("subdir")).unwrap();
115
116 let tool = LsTool;
117 let ctx = ToolContext::new(temp.path().to_path_buf());
118
119 let result = tool.execute(&serde_json::json!({}), &ctx).await.unwrap();
120
121 assert!(result.success);
122 assert!(result.content.contains("file.txt"));
123 assert!(result.content.contains("subdir"));
124 assert!(result.content.contains("dir"));
125 }
126
127 #[tokio::test]
128 async fn test_ls_empty_dir() {

Callers

nothing calls this directly

Calls 3

writeFunction · 0.85
pathMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected