From 7d49db96f38c00dcfa2f1b729c8797f3e4a123b3 Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Thu, 20 Sep 2012 10:34:54 -0400 Subject: [PATCH] add test case for failing #12 --- lib_test/test_runner.ml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib_test/test_runner.ml b/lib_test/test_runner.ml index 81ee404..73ca3e6 100644 --- a/lib_test/test_runner.ml +++ b/lib_test/test_runner.ml @@ -50,6 +50,7 @@ let uri_encodes = [ (Uri.make ~scheme:"https" ~userinfo:"user:pass" ~host:"foo.com" ~port:123 ~path:"/wh/at/ever" ~query:["foo",["1"];"bar",["5"]] ~fragment:"5" ()); "http://foo.com", (Uri.make ~scheme:"http" ~host:"foo.com" ()); + "http://foo-bar.com", (Uri.make ~scheme:"http" ~host:"foo-bar.com" ()); "http://foo%21.com", (Uri.make ~scheme:"http" ~host:"foo!.com" ()); "/wh/at/ev/er", (Uri.make ~path:"/wh/at/ev/er" ()); "/wh/at!/ev%20/er", (Uri.make ~path:"/wh/at!/ev /er" ()); @@ -84,6 +85,14 @@ let test_uri_encode = name >:: test ) uri_encodes +(* Test that a URI decodes to the expected value *) +let test_uri_decode = + List.map (fun (uri_str, uri) -> + let name = sprintf "uribi:%s" uri_str in + let test () = assert_equal ~printer:(fun x -> x) uri_str (Uri.(to_string (of_string (Uri.to_string uri)))) in + name >:: test + ) uri_encodes + (* Test URI query decoding *) let uri_query = [ "https://user:pass@foo.com:123/wh/at/ever?foo=1&bar=5#5", ["foo",["1"]; "bar",["5"]]; @@ -274,7 +283,7 @@ let rec was_successful = false let _ = - let suite = "URI" >::: (test_pct_small @ test_pct_large @ test_uri_encode @ test_query_decode @ test_query_encode @ test_rel_res @ test_file_rel_res @ test_generic_uri_norm @ test_rel_id @ test_tcp_port_of_uri) in + let suite = "URI" >::: (test_pct_small @ test_pct_large @ test_uri_encode @ test_uri_decode @ test_query_decode @ test_query_encode @ test_rel_res @ test_file_rel_res @ test_generic_uri_norm @ test_rel_id @ test_tcp_port_of_uri) in let verbose = ref false in let set_verbose _ = verbose := true in Arg.parse