File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 11
22(tests
3- (names t_util t_buf t_server)
3+ (names t_util t_buf t_server t_io )
44 (package tiny_httpd)
55 (libraries tiny_httpd.core qcheck-core qcheck-core.runner test_util))
Original file line number Diff line number Diff line change 1+ open Test_util
2+ open Tiny_httpd_core.IO
3+
4+ let spf = Printf. sprintf
5+
6+ (* one chunk *)
7+ let () =
8+ let io = Input. of_string " 5\r\n hello\r\n 0\r\n\r\n ARGH" in
9+ let str =
10+ io
11+ |> Input. read_chunked ~bytes: (Bytes. create 4 ) ~fail: failwith
12+ |> Input. read_all_using ~buf: (Buf. create () )
13+ in
14+ assert_eq ~to_string: (spf " %S" ) " hello" str
15+
16+ (* two chunks *)
17+ let () =
18+ let io = Input. of_string " 5\r\n hello\r\n 6\r\n world\r\n 0\r\n\r\n ARGH" in
19+ let str =
20+ io
21+ |> Input. read_chunked ~bytes: (Bytes. create 4 ) ~fail: failwith
22+ |> Input. read_all_using ~buf: (Buf. create () )
23+ in
24+ assert_eq ~to_string: (spf " %S" ) " hello world" str
You can’t perform that action at this time.
0 commit comments