forked from mirage/ocaml-uri
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When resolving URI inherit userinfo from the base URI
- Loading branch information
Showing
2 changed files
with
27 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -292,6 +292,25 @@ let test_rel_rel_res = | |
res >:: test | ||
) uri_rel_rel_res | ||
|
||
let userinfo_res = [ | ||
"http://user:[email protected]/foo", | ||
["bar", "http://user:[email protected]/bar"; | ||
"/", "http://user:[email protected]/"; | ||
"http://boo:[email protected]/foo", "http://boo:[email protected]/foo"; | ||
] | ||
] | ||
|
||
let test_userinfo_res = | ||
userinfo_res |> List.map (fun (base,tests) -> | ||
let base = Uri.of_string base in | ||
List.map (fun (uri,res) -> | ||
let uri = Uri.of_string uri in | ||
let test () = assert_equal ~printer:(fun l -> l) | ||
res (Uri.to_string (Uri.resolve "" base uri)) in | ||
res >::test | ||
) tests | ||
) |> List.fold_left List.rev_append [] | ||
|
||
let generic_uri_norm = [ | ||
"HTTP://example.com/", "http://example.com/"; | ||
"http://example.com/%3a%3f", "http://example.com/:%3F"; | ||
|
@@ -671,6 +690,7 @@ let _ = | |
@ test_rel_res | ||
@ test_file_rel_res | ||
@ test_rel_rel_res | ||
@ test_userinfo_res | ||
@ test_rel_empty_path_res | ||
@ test_generic_uri_norm | ||
@ test_rel_id | ||
|