@@ -90,15 +90,15 @@ func main() {
9090 }
9191 check ("directory_tree (exclude)" , ! r11 .IsError && ! hasFile )
9292
93- // Head/tail
93+ // Offset/Limit pagination
9494 multiFile := filepath .Join (tempDir , "multi.txt" )
95- os .WriteFile (multiFile , []byte ("a\n b\n c\n d\n " ), 0644 )
96- head , tail := 2 , 2
97- r12 , o12 , _ := h .HandleReadTextFile (ctx , nil , handler.ReadTextFileInput {Path : multiFile , Head : & head })
98- check ("read_text_file (head )" , ! r12 .IsError && o12 .Content == "a\n b" )
95+ os .WriteFile (multiFile , []byte ("a\n b\n c\n d" ), 0644 )
96+ limit , offset := 2 , 3
97+ r12 , o12 , _ := h .HandleReadTextFile (ctx , nil , handler.ReadTextFileInput {Path : multiFile , Limit : & limit })
98+ check ("read_text_file (limit=2 )" , ! r12 .IsError && o12 .Content == "a\n b" )
9999
100- r13 , o13 , _ := h .HandleReadTextFile (ctx , nil , handler.ReadTextFileInput {Path : multiFile , Tail : & tail })
101- check ("read_text_file (tail )" , ! r13 .IsError && o13 .Content == "d \n " )
100+ r13 , o13 , _ := h .HandleReadTextFile (ctx , nil , handler.ReadTextFileInput {Path : multiFile , Offset : & offset , Limit : & limit })
101+ check ("read_text_file (offset=3, limit=2 )" , ! r13 .IsError && o13 .Content == "c \n d " )
102102
103103 // Auto-detect and encoding registry
104104 r14 , o14 , _ := h .HandleReadTextFile (ctx , nil , handler.ReadTextFileInput {Path : cyrillicFile })
0 commit comments