| 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() { |