This commit is contained in:
parent
28eb9fae55
commit
b49e352848
5 changed files with 90 additions and 80 deletions
21
test/test.ml
21
test/test.ml
|
|
@ -62,18 +62,21 @@ let () =
|
|||
()
|
||||
|
||||
let () =
|
||||
let open Headers_lib.Etag in
|
||||
let check input = assert (Result.is_ok (parse input)) in
|
||||
let open Headers_lib.If_none_match in
|
||||
(*let check input = assert (Result.is_ok (parse input)) in*)
|
||||
let check input =
|
||||
match parse input with Error e -> Fmt.failwith "%s" e | Ok _ -> ()
|
||||
in
|
||||
let check_bad input = assert (Result.is_error (parse input)) in
|
||||
|
||||
check "*";
|
||||
check "\"foo\"";
|
||||
check "W/\"foo\"";
|
||||
check "\"foo\", \"bar\"";
|
||||
check " W/\"x\" , W/\"y\" , \"z\" ";
|
||||
check " \"one\" , \"two\" , \"three\" ";
|
||||
check "W/\"a\"";
|
||||
check " W/\"a\" , \"b\"";
|
||||
check " , W/\"x\" , W/\"y\" , \"z\"";
|
||||
check ", \"one\" , \"two\" , \"three\"";
|
||||
check "W/\"a\" , ";
|
||||
check "W/\"a\" , \"b\"";
|
||||
|
||||
check_bad "";
|
||||
check_bad "foo";
|
||||
|
|
@ -84,10 +87,8 @@ let () =
|
|||
check_bad "\"a\" \"b\"";
|
||||
check_bad "W/\"a\" W/\"b\"";
|
||||
check_bad "\"fo\x7Fo\"";
|
||||
|
||||
(* TODO trailing comma are valid actually, I think *)
|
||||
check_bad "\"foo\" ,";
|
||||
check_bad ", \"foo\"";
|
||||
check_bad " W/\"a\"";
|
||||
check_bad "W/\"a\" ";
|
||||
()
|
||||
|
||||
(*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue