| 146 | |
| 147 | #[tokio::test] |
| 148 | async fn test_read_with_offset_and_limit() { |
| 149 | let temp = tempfile::tempdir().unwrap(); |
| 150 | let file = temp.path().join("test.txt"); |
| 151 | std::fs::write(&file, "a\nb\nc\nd\ne\n").unwrap(); |
| 152 | |
| 153 | let tool = ReadTool; |
| 154 | let ctx = ToolContext::new(temp.path().to_path_buf()); |
| 155 | let result = tool |
| 156 | .execute( |
| 157 | &serde_json::json!({"file_path": "test.txt", "offset": 1, "limit": 2}), |
| 158 | &ctx, |
| 159 | ) |
| 160 | .await |
| 161 | .unwrap(); |
| 162 | |
| 163 | assert!(result.success); |
| 164 | assert!(result.content.contains("b")); |
| 165 | assert!(result.content.contains("c")); |
| 166 | assert!(!result.content.contains("\ta\n")); |
| 167 | } |
| 168 | |
| 169 | #[tokio::test] |
| 170 | async fn test_read_missing_file() { |