Commit 3680f0bf by Edward Thomson

tests: create the network::url test hierarcy

parent 1196de4f
...@@ -4,19 +4,19 @@ ...@@ -4,19 +4,19 @@
static git_net_url source, target; static git_net_url source, target;
void test_network_joinpath__initialize(void) void test_network_url_joinpath__initialize(void)
{ {
memset(&source, 0, sizeof(source)); memset(&source, 0, sizeof(source));
memset(&target, 0, sizeof(target)); memset(&target, 0, sizeof(target));
} }
void test_network_joinpath__cleanup(void) void test_network_url_joinpath__cleanup(void)
{ {
git_net_url_dispose(&source); git_net_url_dispose(&source);
git_net_url_dispose(&target); git_net_url_dispose(&target);
} }
void test_network_joinpath__target_paths_and_queries(void) void test_network_url_joinpath__target_paths_and_queries(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com/a/b")); cl_git_pass(git_net_url_parse(&source, "http://example.com/a/b"));
...@@ -31,7 +31,7 @@ void test_network_joinpath__target_paths_and_queries(void) ...@@ -31,7 +31,7 @@ void test_network_joinpath__target_paths_and_queries(void)
git_net_url_dispose(&target); git_net_url_dispose(&target);
} }
void test_network_joinpath__source_query_removed(void) void test_network_url_joinpath__source_query_removed(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com/a/b?query&one&two")); cl_git_pass(git_net_url_parse(&source, "http://example.com/a/b?query&one&two"));
...@@ -46,7 +46,7 @@ void test_network_joinpath__source_query_removed(void) ...@@ -46,7 +46,7 @@ void test_network_joinpath__source_query_removed(void)
git_net_url_dispose(&target); git_net_url_dispose(&target);
} }
void test_network_joinpath__source_lacks_path(void) void test_network_url_joinpath__source_lacks_path(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com")); cl_git_pass(git_net_url_parse(&source, "http://example.com"));
...@@ -91,7 +91,7 @@ void test_network_joinpath__source_lacks_path(void) ...@@ -91,7 +91,7 @@ void test_network_joinpath__source_lacks_path(void)
git_net_url_dispose(&target); git_net_url_dispose(&target);
} }
void test_network_joinpath__source_is_slash(void) void test_network_url_joinpath__source_is_slash(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com/")); cl_git_pass(git_net_url_parse(&source, "http://example.com/"));
...@@ -137,7 +137,7 @@ void test_network_joinpath__source_is_slash(void) ...@@ -137,7 +137,7 @@ void test_network_joinpath__source_is_slash(void)
} }
void test_network_joinpath__source_has_query(void) void test_network_url_joinpath__source_has_query(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com?query")); cl_git_pass(git_net_url_parse(&source, "http://example.com?query"));
...@@ -183,7 +183,7 @@ void test_network_joinpath__source_has_query(void) ...@@ -183,7 +183,7 @@ void test_network_joinpath__source_has_query(void)
} }
void test_network_joinpath__empty_query_ignored(void) void test_network_url_joinpath__empty_query_ignored(void)
{ {
cl_git_pass(git_net_url_parse(&source, "http://example.com/foo")); cl_git_pass(git_net_url_parse(&source, "http://example.com/foo"));
......
...@@ -3,19 +3,19 @@ ...@@ -3,19 +3,19 @@
static git_net_url conndata; static git_net_url conndata;
void test_network_urlparse__initialize(void) void test_network_url_parse__initialize(void)
{ {
memset(&conndata, 0, sizeof(conndata)); memset(&conndata, 0, sizeof(conndata));
} }
void test_network_urlparse__cleanup(void) void test_network_url_parse__cleanup(void)
{ {
git_net_url_dispose(&conndata); git_net_url_dispose(&conndata);
} }
/* Hostname */ /* Hostname */
void test_network_urlparse__hostname_trivial(void) void test_network_url_parse__hostname_trivial(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://example.com/resource")); cl_git_pass(git_net_url_parse(&conndata, "http://example.com/resource"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -27,7 +27,7 @@ void test_network_urlparse__hostname_trivial(void) ...@@ -27,7 +27,7 @@ void test_network_urlparse__hostname_trivial(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__hostname_root(void) void test_network_url_parse__hostname_root(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://example.com/")); cl_git_pass(git_net_url_parse(&conndata, "http://example.com/"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -39,7 +39,7 @@ void test_network_urlparse__hostname_root(void) ...@@ -39,7 +39,7 @@ void test_network_urlparse__hostname_root(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__hostname_implied_root(void) void test_network_url_parse__hostname_implied_root(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://example.com")); cl_git_pass(git_net_url_parse(&conndata, "http://example.com"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -51,7 +51,7 @@ void test_network_urlparse__hostname_implied_root(void) ...@@ -51,7 +51,7 @@ void test_network_urlparse__hostname_implied_root(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__hostname_implied_root_custom_port(void) void test_network_url_parse__hostname_implied_root_custom_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://example.com:42")); cl_git_pass(git_net_url_parse(&conndata, "http://example.com:42"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -63,7 +63,7 @@ void test_network_urlparse__hostname_implied_root_custom_port(void) ...@@ -63,7 +63,7 @@ void test_network_urlparse__hostname_implied_root_custom_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__hostname_implied_root_empty_port(void) void test_network_url_parse__hostname_implied_root_empty_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://example.com:")); cl_git_pass(git_net_url_parse(&conndata, "http://example.com:"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -75,7 +75,7 @@ void test_network_urlparse__hostname_implied_root_empty_port(void) ...@@ -75,7 +75,7 @@ void test_network_urlparse__hostname_implied_root_empty_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__hostname_encoded_password(void) void test_network_url_parse__hostname_encoded_password(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass%2fis%40bad@hostname.com:1234/")); "https://user:pass%2fis%40bad@hostname.com:1234/"));
...@@ -88,7 +88,7 @@ void test_network_urlparse__hostname_encoded_password(void) ...@@ -88,7 +88,7 @@ void test_network_urlparse__hostname_encoded_password(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__hostname_user(void) void test_network_url_parse__hostname_user(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user@example.com/resource")); "https://user@example.com/resource"));
...@@ -101,7 +101,7 @@ void test_network_urlparse__hostname_user(void) ...@@ -101,7 +101,7 @@ void test_network_urlparse__hostname_user(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__hostname_user_pass(void) void test_network_url_parse__hostname_user_pass(void)
{ {
/* user:pass@hostname.tld/resource */ /* user:pass@hostname.tld/resource */
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
...@@ -115,7 +115,7 @@ void test_network_urlparse__hostname_user_pass(void) ...@@ -115,7 +115,7 @@ void test_network_urlparse__hostname_user_pass(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__hostname_port(void) void test_network_url_parse__hostname_port(void)
{ {
/* hostname.tld:port/resource */ /* hostname.tld:port/resource */
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
...@@ -129,7 +129,7 @@ void test_network_urlparse__hostname_port(void) ...@@ -129,7 +129,7 @@ void test_network_urlparse__hostname_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__hostname_empty_port(void) void test_network_url_parse__hostname_empty_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://example.com:/resource")); cl_git_pass(git_net_url_parse(&conndata, "http://example.com:/resource"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -141,7 +141,7 @@ void test_network_urlparse__hostname_empty_port(void) ...@@ -141,7 +141,7 @@ void test_network_urlparse__hostname_empty_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__hostname_user_port(void) void test_network_url_parse__hostname_user_port(void)
{ {
/* user@hostname.tld:port/resource */ /* user@hostname.tld:port/resource */
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
...@@ -155,7 +155,7 @@ void test_network_urlparse__hostname_user_port(void) ...@@ -155,7 +155,7 @@ void test_network_urlparse__hostname_user_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__hostname_user_pass_port(void) void test_network_url_parse__hostname_user_pass_port(void)
{ {
/* user:pass@hostname.tld:port/resource */ /* user:pass@hostname.tld:port/resource */
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
...@@ -171,7 +171,7 @@ void test_network_urlparse__hostname_user_pass_port(void) ...@@ -171,7 +171,7 @@ void test_network_urlparse__hostname_user_pass_port(void)
/* IPv4 addresses */ /* IPv4 addresses */
void test_network_urlparse__ipv4_trivial(void) void test_network_url_parse__ipv4_trivial(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1/resource")); cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1/resource"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -183,7 +183,7 @@ void test_network_urlparse__ipv4_trivial(void) ...@@ -183,7 +183,7 @@ void test_network_urlparse__ipv4_trivial(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv4_root(void) void test_network_url_parse__ipv4_root(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1/")); cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1/"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -195,7 +195,7 @@ void test_network_urlparse__ipv4_root(void) ...@@ -195,7 +195,7 @@ void test_network_urlparse__ipv4_root(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv4_implied_root(void) void test_network_url_parse__ipv4_implied_root(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1")); cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -207,7 +207,7 @@ void test_network_urlparse__ipv4_implied_root(void) ...@@ -207,7 +207,7 @@ void test_network_urlparse__ipv4_implied_root(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv4_implied_root_custom_port(void) void test_network_url_parse__ipv4_implied_root_custom_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:42")); cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:42"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -219,7 +219,7 @@ void test_network_urlparse__ipv4_implied_root_custom_port(void) ...@@ -219,7 +219,7 @@ void test_network_urlparse__ipv4_implied_root_custom_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__ipv4_implied_root_empty_port(void) void test_network_url_parse__ipv4_implied_root_empty_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:")); cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -231,7 +231,7 @@ void test_network_urlparse__ipv4_implied_root_empty_port(void) ...@@ -231,7 +231,7 @@ void test_network_urlparse__ipv4_implied_root_empty_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv4_encoded_password(void) void test_network_url_parse__ipv4_encoded_password(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass%2fis%40bad@192.168.1.1:1234/")); "https://user:pass%2fis%40bad@192.168.1.1:1234/"));
...@@ -244,7 +244,7 @@ void test_network_urlparse__ipv4_encoded_password(void) ...@@ -244,7 +244,7 @@ void test_network_urlparse__ipv4_encoded_password(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__ipv4_user(void) void test_network_url_parse__ipv4_user(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user@192.168.1.1/resource")); "https://user@192.168.1.1/resource"));
...@@ -257,7 +257,7 @@ void test_network_urlparse__ipv4_user(void) ...@@ -257,7 +257,7 @@ void test_network_urlparse__ipv4_user(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv4_user_pass(void) void test_network_url_parse__ipv4_user_pass(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass@192.168.1.1/resource")); "https://user:pass@192.168.1.1/resource"));
...@@ -270,7 +270,7 @@ void test_network_urlparse__ipv4_user_pass(void) ...@@ -270,7 +270,7 @@ void test_network_urlparse__ipv4_user_pass(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv4_port(void) void test_network_url_parse__ipv4_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://192.168.1.1:9191/resource")); "https://192.168.1.1:9191/resource"));
...@@ -283,7 +283,7 @@ void test_network_urlparse__ipv4_port(void) ...@@ -283,7 +283,7 @@ void test_network_urlparse__ipv4_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__ipv4_empty_port(void) void test_network_url_parse__ipv4_empty_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:/resource")); cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:/resource"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -295,7 +295,7 @@ void test_network_urlparse__ipv4_empty_port(void) ...@@ -295,7 +295,7 @@ void test_network_urlparse__ipv4_empty_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv4_user_port(void) void test_network_url_parse__ipv4_user_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user@192.168.1.1:9191/resource")); "https://user@192.168.1.1:9191/resource"));
...@@ -308,7 +308,7 @@ void test_network_urlparse__ipv4_user_port(void) ...@@ -308,7 +308,7 @@ void test_network_urlparse__ipv4_user_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__ipv4_user_pass_port(void) void test_network_url_parse__ipv4_user_pass_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass@192.168.1.1:9191/resource")); "https://user:pass@192.168.1.1:9191/resource"));
...@@ -323,7 +323,7 @@ void test_network_urlparse__ipv4_user_pass_port(void) ...@@ -323,7 +323,7 @@ void test_network_urlparse__ipv4_user_pass_port(void)
/* IPv6 addresses */ /* IPv6 addresses */
void test_network_urlparse__ipv6_trivial(void) void test_network_url_parse__ipv6_trivial(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]/resource")); cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]/resource"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -335,7 +335,7 @@ void test_network_urlparse__ipv6_trivial(void) ...@@ -335,7 +335,7 @@ void test_network_urlparse__ipv6_trivial(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv6_root(void) void test_network_url_parse__ipv6_root(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]/")); cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]/"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -347,7 +347,7 @@ void test_network_urlparse__ipv6_root(void) ...@@ -347,7 +347,7 @@ void test_network_urlparse__ipv6_root(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv6_implied_root(void) void test_network_url_parse__ipv6_implied_root(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]")); cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -359,7 +359,7 @@ void test_network_urlparse__ipv6_implied_root(void) ...@@ -359,7 +359,7 @@ void test_network_urlparse__ipv6_implied_root(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv6_implied_root_custom_port(void) void test_network_url_parse__ipv6_implied_root_custom_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:42")); cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:42"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -371,7 +371,7 @@ void test_network_urlparse__ipv6_implied_root_custom_port(void) ...@@ -371,7 +371,7 @@ void test_network_urlparse__ipv6_implied_root_custom_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__ipv6_implied_root_empty_port(void) void test_network_url_parse__ipv6_implied_root_empty_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:")); cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -383,7 +383,7 @@ void test_network_urlparse__ipv6_implied_root_empty_port(void) ...@@ -383,7 +383,7 @@ void test_network_urlparse__ipv6_implied_root_empty_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv6_encoded_password(void) void test_network_url_parse__ipv6_encoded_password(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass%2fis%40bad@[fe80::dcad:beff:fe00:0001]:1234/")); "https://user:pass%2fis%40bad@[fe80::dcad:beff:fe00:0001]:1234/"));
...@@ -396,7 +396,7 @@ void test_network_urlparse__ipv6_encoded_password(void) ...@@ -396,7 +396,7 @@ void test_network_urlparse__ipv6_encoded_password(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__ipv6_user(void) void test_network_url_parse__ipv6_user(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user@[fe80::dcad:beff:fe00:0001]/resource")); "https://user@[fe80::dcad:beff:fe00:0001]/resource"));
...@@ -409,7 +409,7 @@ void test_network_urlparse__ipv6_user(void) ...@@ -409,7 +409,7 @@ void test_network_urlparse__ipv6_user(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv6_user_pass(void) void test_network_url_parse__ipv6_user_pass(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass@[fe80::dcad:beff:fe00:0001]/resource")); "https://user:pass@[fe80::dcad:beff:fe00:0001]/resource"));
...@@ -422,7 +422,7 @@ void test_network_urlparse__ipv6_user_pass(void) ...@@ -422,7 +422,7 @@ void test_network_urlparse__ipv6_user_pass(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv6_port(void) void test_network_url_parse__ipv6_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://[fe80::dcad:beff:fe00:0001]:9191/resource")); "https://[fe80::dcad:beff:fe00:0001]:9191/resource"));
...@@ -435,7 +435,7 @@ void test_network_urlparse__ipv6_port(void) ...@@ -435,7 +435,7 @@ void test_network_urlparse__ipv6_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__ipv6_empty_port(void) void test_network_url_parse__ipv6_empty_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:/resource")); cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:/resource"));
cl_assert_equal_s(conndata.scheme, "http"); cl_assert_equal_s(conndata.scheme, "http");
...@@ -447,7 +447,7 @@ void test_network_urlparse__ipv6_empty_port(void) ...@@ -447,7 +447,7 @@ void test_network_urlparse__ipv6_empty_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
} }
void test_network_urlparse__ipv6_user_port(void) void test_network_url_parse__ipv6_user_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user@[fe80::dcad:beff:fe00:0001]:9191/resource")); "https://user@[fe80::dcad:beff:fe00:0001]:9191/resource"));
...@@ -460,7 +460,7 @@ void test_network_urlparse__ipv6_user_port(void) ...@@ -460,7 +460,7 @@ void test_network_urlparse__ipv6_user_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__ipv6_user_pass_port(void) void test_network_url_parse__ipv6_user_pass_port(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass@[fe80::dcad:beff:fe00:0001]:9191/resource")); "https://user:pass@[fe80::dcad:beff:fe00:0001]:9191/resource"));
...@@ -473,7 +473,7 @@ void test_network_urlparse__ipv6_user_pass_port(void) ...@@ -473,7 +473,7 @@ void test_network_urlparse__ipv6_user_pass_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
} }
void test_network_urlparse__ipv6_invalid_addresses(void) void test_network_url_parse__ipv6_invalid_addresses(void)
{ {
/* Opening bracket missing */ /* Opening bracket missing */
cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata, cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
......
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
static git_net_url conndata; static git_net_url conndata;
void test_network_redirect__initialize(void) void test_network_url_redirect__initialize(void)
{ {
memset(&conndata, 0, sizeof(conndata)); memset(&conndata, 0, sizeof(conndata));
} }
void test_network_redirect__cleanup(void) void test_network_url_redirect__cleanup(void)
{ {
git_net_url_dispose(&conndata); git_net_url_dispose(&conndata);
} }
void test_network_redirect__redirect_http(void) void test_network_url_redirect__redirect_http(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"http://example.com/foo/bar/baz")); "http://example.com/foo/bar/baz"));
...@@ -28,7 +28,7 @@ void test_network_redirect__redirect_http(void) ...@@ -28,7 +28,7 @@ void test_network_redirect__redirect_http(void)
cl_assert_equal_p(conndata.password, NULL); cl_assert_equal_p(conndata.password, NULL);
} }
void test_network_redirect__redirect_ssl(void) void test_network_url_redirect__redirect_ssl(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://example.com/foo/bar/baz")); "https://example.com/foo/bar/baz"));
...@@ -42,7 +42,7 @@ void test_network_redirect__redirect_ssl(void) ...@@ -42,7 +42,7 @@ void test_network_redirect__redirect_ssl(void)
cl_assert_equal_p(conndata.password, NULL); cl_assert_equal_p(conndata.password, NULL);
} }
void test_network_redirect__redirect_leaves_root_path(void) void test_network_url_redirect__redirect_leaves_root_path(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://example.com/foo/bar/baz")); "https://example.com/foo/bar/baz"));
...@@ -56,7 +56,7 @@ void test_network_redirect__redirect_leaves_root_path(void) ...@@ -56,7 +56,7 @@ void test_network_redirect__redirect_leaves_root_path(void)
cl_assert_equal_p(conndata.password, NULL); cl_assert_equal_p(conndata.password, NULL);
} }
void test_network_redirect__redirect_encoded_username_password(void) void test_network_url_redirect__redirect_encoded_username_password(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, cl_git_pass(git_net_url_parse(&conndata,
"https://user%2fname:pass%40word%zyx%v@example.com/foo/bar/baz")); "https://user%2fname:pass%40word%zyx%v@example.com/foo/bar/baz"));
...@@ -70,7 +70,7 @@ void test_network_redirect__redirect_encoded_username_password(void) ...@@ -70,7 +70,7 @@ void test_network_redirect__redirect_encoded_username_password(void)
cl_assert_equal_s(conndata.password, "pass@word%zyx%v"); cl_assert_equal_s(conndata.password, "pass@word%zyx%v");
} }
void test_network_redirect__redirect_cross_host_denied(void) void test_network_url_redirect__redirect_cross_host_denied(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "https://bar.com/bar/baz")); cl_git_pass(git_net_url_parse(&conndata, "https://bar.com/bar/baz"));
cl_git_fail_with(git_net_url_apply_redirect(&conndata, cl_git_fail_with(git_net_url_apply_redirect(&conndata,
...@@ -78,7 +78,7 @@ void test_network_redirect__redirect_cross_host_denied(void) ...@@ -78,7 +78,7 @@ void test_network_redirect__redirect_cross_host_denied(void)
-1); -1);
} }
void test_network_redirect__redirect_http_downgrade_denied(void) void test_network_url_redirect__redirect_http_downgrade_denied(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/baz")); cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/baz"));
cl_git_fail_with(git_net_url_apply_redirect(&conndata, cl_git_fail_with(git_net_url_apply_redirect(&conndata,
...@@ -86,7 +86,7 @@ void test_network_redirect__redirect_http_downgrade_denied(void) ...@@ -86,7 +86,7 @@ void test_network_redirect__redirect_http_downgrade_denied(void)
-1); -1);
} }
void test_network_redirect__redirect_relative(void) void test_network_url_redirect__redirect_relative(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "http://foo.com/bar/baz/biff")); cl_git_pass(git_net_url_parse(&conndata, "http://foo.com/bar/baz/biff"));
cl_git_pass(git_net_url_apply_redirect(&conndata, cl_git_pass(git_net_url_apply_redirect(&conndata,
...@@ -99,7 +99,7 @@ void test_network_redirect__redirect_relative(void) ...@@ -99,7 +99,7 @@ void test_network_redirect__redirect_relative(void)
cl_assert_equal_p(conndata.password, NULL); cl_assert_equal_p(conndata.password, NULL);
} }
void test_network_redirect__redirect_relative_ssl(void) void test_network_url_redirect__redirect_relative_ssl(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/baz/biff")); cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/baz/biff"));
cl_git_pass(git_net_url_apply_redirect(&conndata, cl_git_pass(git_net_url_apply_redirect(&conndata,
...@@ -112,7 +112,7 @@ void test_network_redirect__redirect_relative_ssl(void) ...@@ -112,7 +112,7 @@ void test_network_redirect__redirect_relative_ssl(void)
cl_assert_equal_p(conndata.password, NULL); cl_assert_equal_p(conndata.password, NULL);
} }
void test_network_redirect__service_query_no_query_params_in_location(void) void test_network_url_redirect__service_query_no_query_params_in_location(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/info/refs?service=git-upload-pack")); cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/info/refs?service=git-upload-pack"));
cl_git_pass(git_net_url_apply_redirect(&conndata, cl_git_pass(git_net_url_apply_redirect(&conndata,
...@@ -120,7 +120,7 @@ void test_network_redirect__service_query_no_query_params_in_location(void) ...@@ -120,7 +120,7 @@ void test_network_redirect__service_query_no_query_params_in_location(void)
cl_assert_equal_s(conndata.path, "/baz"); cl_assert_equal_s(conndata.path, "/baz");
} }
void test_network_redirect__service_query_with_query_params_in_location(void) void test_network_url_redirect__service_query_with_query_params_in_location(void)
{ {
cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/info/refs?service=git-upload-pack")); cl_git_pass(git_net_url_parse(&conndata, "https://foo.com/bar/info/refs?service=git-upload-pack"));
cl_git_pass(git_net_url_apply_redirect(&conndata, cl_git_pass(git_net_url_apply_redirect(&conndata,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment