File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -21,4 +21,22 @@ let () =
2121 |> Input. read_chunked ~bytes: (Bytes. create 4 ) ~fail: failwith
2222 |> Input. read_all_using ~buf: (Buf. create () )
2323 in
24- assert_eq ~to_string: (spf " %S" ) " hello world" str
24+ assert_eq ~to_string: (spf " %S" ) " hello world" str;
25+
26+ let str_rest = io |> Input. read_all_using ~buf: (Buf. create () ) in
27+ assert_eq ~to_string: (spf " %S" ) " ARGH" str_rest;
28+ ()
29+
30+ (* two chunks *)
31+ let () =
32+ let io = Input. of_string " 10\r\n {\" poCheck\" :true}\r\n 0\r\n\r\n " in
33+ let str =
34+ io
35+ |> Input. read_chunked ~bytes: (Bytes. create 4 ) ~fail: failwith
36+ |> Input. read_all_using ~buf: (Buf. create () )
37+ in
38+ assert_eq ~to_string: (spf " %S" ) {| {" poCheck" :true }| } str;
39+
40+ let str_rest = io |> Input. read_all_using ~buf: (Buf. create () ) in
41+ assert_eq ~to_string: (spf " %S" ) " " str_rest;
42+ ()
You can’t perform that action at this time.
0 commit comments