| 239 | |
| 240 | #[tokio::test] |
| 241 | async fn test_edit_not_found() { |
| 242 | let temp = tempfile::tempdir().unwrap(); |
| 243 | std::fs::write(temp.path().join("test.txt"), "hello world").unwrap(); |
| 244 | |
| 245 | let tool = EditTool; |
| 246 | let ctx = ToolContext::new(temp.path().to_path_buf()); |
| 247 | |
| 248 | let result = tool |
| 249 | .execute( |
| 250 | &serde_json::json!({ |
| 251 | "file_path": "test.txt", |
| 252 | "old_string": "xyz", |
| 253 | "new_string": "abc" |
| 254 | }), |
| 255 | &ctx, |
| 256 | ) |
| 257 | .await |
| 258 | .unwrap(); |
| 259 | |
| 260 | assert!(!result.success); |
| 261 | assert!(result.content.contains("not found")); |
| 262 | } |
| 263 | |
| 264 | #[test] |
| 265 | fn test_edit_schema_is_canonical() { |