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

Function test_edit_not_unique

core/src/tools/builtin/edit.rs:217–238  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

215
216 #[tokio::test]
217 async fn test_edit_not_unique() {
218 let temp = tempfile::tempdir().unwrap();
219 std::fs::write(temp.path().join("test.txt"), "aaa bbb aaa").unwrap();
220
221 let tool = EditTool;
222 let ctx = ToolContext::new(temp.path().to_path_buf());
223
224 let result = tool
225 .execute(
226 &serde_json::json!({
227 "file_path": "test.txt",
228 "old_string": "aaa",
229 "new_string": "ccc"
230 }),
231 &ctx,
232 )
233 .await
234 .unwrap();
235
236 assert!(!result.success);
237 assert!(result.content.contains("2 times"));
238 }
239
240 #[tokio::test]
241 async fn test_edit_not_found() {

Callers

nothing calls this directly

Calls 3

writeFunction · 0.85
pathMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected