This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,5 @@
(tests
(names fuzz)
(package uri-re)
(libraries uri uri-re crowbar)
(deps (source_tree input)))

View 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
);

View file

@ -0,0 +1 @@
foo