mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 11:15:35 -05:00
add more tests
This commit is contained in:
parent
b6cd59f084
commit
4705278c3b
1 changed files with 19 additions and 1 deletions
|
|
@ -21,4 +21,22 @@ let () =
|
||||||
|> Input.read_chunked ~bytes:(Bytes.create 4) ~fail:failwith
|
|> Input.read_chunked ~bytes:(Bytes.create 4) ~fail:failwith
|
||||||
|> Input.read_all_using ~buf:(Buf.create ())
|
|> Input.read_all_using ~buf:(Buf.create ())
|
||||||
in
|
in
|
||||||
assert_eq ~to_string:(spf "%S") "hello world" str
|
assert_eq ~to_string:(spf "%S") "hello world" str;
|
||||||
|
|
||||||
|
let str_rest = io |> Input.read_all_using ~buf:(Buf.create ()) in
|
||||||
|
assert_eq ~to_string:(spf "%S") "ARGH" str_rest;
|
||||||
|
()
|
||||||
|
|
||||||
|
(* two chunks *)
|
||||||
|
let () =
|
||||||
|
let io = Input.of_string "10\r\n{\"poCheck\":true}\r\n0\r\n\r\n" in
|
||||||
|
let str =
|
||||||
|
io
|
||||||
|
|> Input.read_chunked ~bytes:(Bytes.create 4) ~fail:failwith
|
||||||
|
|> Input.read_all_using ~buf:(Buf.create ())
|
||||||
|
in
|
||||||
|
assert_eq ~to_string:(spf "%S") {|{"poCheck":true}|} str;
|
||||||
|
|
||||||
|
let str_rest = io |> Input.read_all_using ~buf:(Buf.create ()) in
|
||||||
|
assert_eq ~to_string:(spf "%S") "" str_rest;
|
||||||
|
()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue