| 147 | |
| 148 | #[tokio::test] |
| 149 | async fn test_write_overwrite() { |
| 150 | let temp = tempfile::tempdir().unwrap(); |
| 151 | std::fs::write(temp.path().join("existing.txt"), "old").unwrap(); |
| 152 | |
| 153 | let tool = WriteTool; |
| 154 | let ctx = ToolContext::new(temp.path().to_path_buf()); |
| 155 | |
| 156 | let result = tool |
| 157 | .execute( |
| 158 | &serde_json::json!({"file_path": "existing.txt", "content": "new"}), |
| 159 | &ctx, |
| 160 | ) |
| 161 | .await |
| 162 | .unwrap(); |
| 163 | |
| 164 | assert!(result.success); |
| 165 | let content = std::fs::read_to_string(temp.path().join("existing.txt")).unwrap(); |
| 166 | assert_eq!(content, "new"); |
| 167 | } |
| 168 | |
| 169 | #[tokio::test] |
| 170 | async fn test_write_missing_params() { |