This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
46
unikernel/duniverse/ocaml-uri/fuzz/fuzz.ml
Normal file
46
unikernel/duniverse/ocaml-uri/fuzz/fuzz.ml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
open Crowbar
|
||||
|
||||
let () =
|
||||
add_test ~name:"create" [bytes] (fun a ->
|
||||
(* Parse \n as this is a known deviation of behaviour *)
|
||||
let a = Str.(global_replace (regexp_string "\n") a "") in
|
||||
let x = try Uri.(of_string a |> to_string) with _ -> "" in
|
||||
let y = try Uri_legacy.(of_string a |> to_string) with _ -> "" in
|
||||
check_eq ~pp:pp_string x y
|
||||
);
|
||||
add_test ~name:"query" [bytes] (fun a ->
|
||||
(* Parse \n as this is a known deviation of behaviour *)
|
||||
let a = Str.(global_replace (regexp_string "\n") a "") in
|
||||
let x = try Uri.(of_string a |> query) with _ -> [] in
|
||||
let y = try Uri_legacy.(of_string a |> query) with _ -> [] in
|
||||
check_eq x y
|
||||
);
|
||||
add_test ~name:"scheme" [bytes] (fun a ->
|
||||
(* Parse \n as this is a known deviation of behaviour *)
|
||||
let a = Str.(global_replace (regexp_string "\n") a "") in
|
||||
let x = try Uri.(of_string a |> scheme) with _ -> None in
|
||||
let y = try Uri_legacy.(of_string a |> scheme) with _ -> None in
|
||||
check_eq x y
|
||||
);
|
||||
add_test ~name:"host" [bytes] (fun a ->
|
||||
(* Parse \n as this is a known deviation of behaviour *)
|
||||
let a = Str.(global_replace (regexp_string "\n") a "") in
|
||||
let x = try Uri.(of_string a |> host) with _ -> None in
|
||||
let y = try Uri_legacy.(of_string a |> host) with _ -> None in
|
||||
check_eq x y
|
||||
);
|
||||
add_test ~name:"userinfo" [bytes] (fun a ->
|
||||
(* Parse \n as this is a known deviation of behaviour *)
|
||||
let a = Str.(global_replace (regexp_string "\n") a "") in
|
||||
let x = try Uri.(of_string a |> userinfo) with _ -> None in
|
||||
let y = try Uri_legacy.(of_string a |> userinfo) with _ -> None in
|
||||
check_eq x y
|
||||
);
|
||||
add_test ~name:"port" [bytes] (fun a ->
|
||||
(* Parse \n as this is a known deviation of behaviour *)
|
||||
let a = Str.(global_replace (regexp_string "\n") a "") in
|
||||
let x = try Uri.(of_string a |> port) with _ -> None in
|
||||
let y = try Uri_legacy.(of_string a |> port) with _ -> None in
|
||||
check_eq x y
|
||||
);
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue