@@ -341,3 +341,35 @@ async def test_read_multiple_ranges_out_of_bounds_start(editor, test_file):
341
341
assert second_range ["end_line" ] == 6
342
342
assert second_range ["total_lines" ] == 5
343
343
assert second_range ["content_size" ] == 0
344
+
345
+
346
+ @pytest .mark .asyncio
347
+ async def test_read_multiple_ranges_out_of_bounds_end (editor , test_file ):
348
+ """Test reading ranges where end line exceeds file length."""
349
+ ranges = [
350
+ {
351
+ "file_path" : test_file ,
352
+ "ranges" : [
353
+ {"start" : 1 , "end" : 1000 }, # End way beyond file end
354
+ {"start" : 2 , "end" : 6 }, # End just beyond file end
355
+ ],
356
+ }
357
+ ]
358
+
359
+ result = await editor .read_multiple_ranges (ranges )
360
+
361
+ # Check first range (end line way beyond file end)
362
+ first_range = result [test_file ][0 ]
363
+ assert first_range ["content" ] == "Line 1\n Line 2\n Line 3\n Line 4\n Line 5\n "
364
+ assert first_range ["start_line" ] == 1
365
+ assert first_range ["end_line" ] == 5
366
+ assert first_range ["total_lines" ] == 5
367
+ assert first_range ["content_size" ] == len (first_range ["content" ])
368
+
369
+ # Check second range (end line just beyond file end)
370
+ second_range = result [test_file ][1 ]
371
+ assert second_range ["content" ] == "Line 2\n Line 3\n Line 4\n Line 5\n "
372
+ assert second_range ["start_line" ] == 2
373
+ assert second_range ["end_line" ] == 5
374
+ assert second_range ["total_lines" ] == 5
375
+ assert second_range ["content_size" ] == len (second_range ["content" ])
0 commit comments