summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-11-23 13:57:07 +0000
committerGitHub <noreply@github.com>2022-11-23 13:57:07 +0000
commit12832bab7363e92bfa45d1ef3c3bc10495d71abd (patch)
tree6fd346ca691c1cd39a0e3058a9dfe5075d460eb8 /tests
parentd0203b6484812a44331e99d6754c955844d49fdb (diff)
parent1ee9b1fb2d5bb60b1f02d3767282afa2b8c8c016 (diff)
downloadlibgit2-12832bab7363e92bfa45d1ef3c3bc10495d71abd.tar.gz
Merge pull request #6326 from libgit2/ethomson/url_parse
URL parsing for google-compatible URLs
Diffstat (limited to 'tests')
-rw-r--r--tests/util/url/joinpath.c (renamed from tests/libgit2/network/url/joinpath.c)16
-rw-r--r--tests/util/url/parse.c (renamed from tests/libgit2/network/url/parse.c)312
-rw-r--r--tests/util/url/pattern.c (renamed from tests/libgit2/network/url/pattern.c)4
-rw-r--r--tests/util/url/redirect.c (renamed from tests/libgit2/network/url/redirect.c)26
-rw-r--r--tests/util/url/scp.c (renamed from tests/libgit2/network/url/scp.c)50
-rw-r--r--tests/util/url/valid.c (renamed from tests/libgit2/network/url/valid.c)2
6 files changed, 320 insertions, 90 deletions
diff --git a/tests/libgit2/network/url/joinpath.c b/tests/util/url/joinpath.c
index bf4557138..9fc02cde4 100644
--- a/tests/libgit2/network/url/joinpath.c
+++ b/tests/util/url/joinpath.c
@@ -4,19 +4,19 @@
static git_net_url source, target;
-void test_network_url_joinpath__initialize(void)
+void test_url_joinpath__initialize(void)
{
memset(&source, 0, sizeof(source));
memset(&target, 0, sizeof(target));
}
-void test_network_url_joinpath__cleanup(void)
+void test_url_joinpath__cleanup(void)
{
git_net_url_dispose(&source);
git_net_url_dispose(&target);
}
-void test_network_url_joinpath__target_paths_and_queries(void)
+void test_url_joinpath__target_paths_and_queries(void)
{
cl_git_pass(git_net_url_parse(&source, "http://example.com/a/b"));
@@ -31,7 +31,7 @@ void test_network_url_joinpath__target_paths_and_queries(void)
git_net_url_dispose(&target);
}
-void test_network_url_joinpath__source_query_removed(void)
+void test_url_joinpath__source_query_removed(void)
{
cl_git_pass(git_net_url_parse(&source, "http://example.com/a/b?query&one&two"));
@@ -46,7 +46,7 @@ void test_network_url_joinpath__source_query_removed(void)
git_net_url_dispose(&target);
}
-void test_network_url_joinpath__source_lacks_path(void)
+void test_url_joinpath__source_lacks_path(void)
{
cl_git_pass(git_net_url_parse(&source, "http://example.com"));
@@ -91,7 +91,7 @@ void test_network_url_joinpath__source_lacks_path(void)
git_net_url_dispose(&target);
}
-void test_network_url_joinpath__source_is_slash(void)
+void test_url_joinpath__source_is_slash(void)
{
cl_git_pass(git_net_url_parse(&source, "http://example.com/"));
@@ -137,7 +137,7 @@ void test_network_url_joinpath__source_is_slash(void)
}
-void test_network_url_joinpath__source_has_query(void)
+void test_url_joinpath__source_has_query(void)
{
cl_git_pass(git_net_url_parse(&source, "http://example.com?query"));
@@ -183,7 +183,7 @@ void test_network_url_joinpath__source_has_query(void)
}
-void test_network_url_joinpath__empty_query_ignored(void)
+void test_url_joinpath__empty_query_ignored(void)
{
cl_git_pass(git_net_url_parse(&source, "http://example.com/foo"));
diff --git a/tests/libgit2/network/url/parse.c b/tests/util/url/parse.c
index 8149ba52c..631d9b456 100644
--- a/tests/libgit2/network/url/parse.c
+++ b/tests/util/url/parse.c
@@ -3,19 +3,19 @@
static git_net_url conndata;
-void test_network_url_parse__initialize(void)
+void test_url_parse__initialize(void)
{
memset(&conndata, 0, sizeof(conndata));
}
-void test_network_url_parse__cleanup(void)
+void test_url_parse__cleanup(void)
{
git_net_url_dispose(&conndata);
}
/* Hostname */
-void test_network_url_parse__hostname_trivial(void)
+void test_url_parse__hostname_trivial(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://example.com/resource"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -24,10 +24,12 @@ void test_network_url_parse__hostname_trivial(void)
cl_assert_equal_s(conndata.path, "/resource");
cl_assert_equal_p(conndata.username, NULL);
cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__hostname_root(void)
+void test_url_parse__hostname_root(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://example.com/"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -36,10 +38,12 @@ void test_network_url_parse__hostname_root(void)
cl_assert_equal_s(conndata.path, "/");
cl_assert_equal_p(conndata.username, NULL);
cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__hostname_implied_root(void)
+void test_url_parse__hostname_implied_root(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://example.com"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -48,10 +52,26 @@ void test_network_url_parse__hostname_implied_root(void)
cl_assert_equal_s(conndata.path, "/");
cl_assert_equal_p(conndata.username, NULL);
cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__hostname_implied_root_custom_port(void)
+void test_url_parse__hostname_numeric(void)
+{
+ cl_git_pass(git_net_url_parse(&conndata, "http://8888888/"));
+ cl_assert_equal_s(conndata.scheme, "http");
+ cl_assert_equal_s(conndata.host, "8888888");
+ cl_assert_equal_s(conndata.port, "80");
+ cl_assert_equal_s(conndata.path, "/");
+ cl_assert_equal_p(conndata.username, NULL);
+ cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
+}
+
+void test_url_parse__hostname_implied_root_custom_port(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://example.com:42"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -60,10 +80,12 @@ void test_network_url_parse__hostname_implied_root_custom_port(void)
cl_assert_equal_s(conndata.path, "/");
cl_assert_equal_p(conndata.username, NULL);
cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__hostname_implied_root_empty_port(void)
+void test_url_parse__hostname_implied_root_empty_port(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://example.com:"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -72,10 +94,12 @@ void test_network_url_parse__hostname_implied_root_empty_port(void)
cl_assert_equal_s(conndata.path, "/");
cl_assert_equal_p(conndata.username, NULL);
cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__hostname_encoded_password(void)
+void test_url_parse__hostname_encoded_password(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass%2fis%40bad@hostname.com:1234/"));
@@ -85,10 +109,12 @@ void test_network_url_parse__hostname_encoded_password(void)
cl_assert_equal_s(conndata.path, "/");
cl_assert_equal_s(conndata.username, "user");
cl_assert_equal_s(conndata.password, "pass/is@bad");
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__hostname_user(void)
+void test_url_parse__hostname_user(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user@example.com/resource"));
@@ -98,10 +124,12 @@ void test_network_url_parse__hostname_user(void)
cl_assert_equal_s(conndata.path, "/resource");
cl_assert_equal_s(conndata.username, "user");
cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__hostname_user_pass(void)
+void test_url_parse__hostname_user_pass(void)
{
/* user:pass@hostname.tld/resource */
cl_git_pass(git_net_url_parse(&conndata,
@@ -112,10 +140,12 @@ void test_network_url_parse__hostname_user_pass(void)
cl_assert_equal_s(conndata.path, "/resource");
cl_assert_equal_s(conndata.username, "user");
cl_assert_equal_s(conndata.password, "pass");
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__hostname_port(void)
+void test_url_parse__hostname_port(void)
{
/* hostname.tld:port/resource */
cl_git_pass(git_net_url_parse(&conndata,
@@ -126,10 +156,12 @@ void test_network_url_parse__hostname_port(void)
cl_assert_equal_s(conndata.path, "/resource");
cl_assert_equal_p(conndata.username, NULL);
cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__hostname_empty_port(void)
+void test_url_parse__hostname_empty_port(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://example.com:/resource"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -138,10 +170,12 @@ void test_network_url_parse__hostname_empty_port(void)
cl_assert_equal_s(conndata.path, "/resource");
cl_assert_equal_p(conndata.username, NULL);
cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__hostname_user_port(void)
+void test_url_parse__hostname_user_port(void)
{
/* user@hostname.tld:port/resource */
cl_git_pass(git_net_url_parse(&conndata,
@@ -152,10 +186,12 @@ void test_network_url_parse__hostname_user_port(void)
cl_assert_equal_s(conndata.path, "/resource");
cl_assert_equal_s(conndata.username, "user");
cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__hostname_user_pass_port(void)
+void test_url_parse__hostname_user_pass_port(void)
{
/* user:pass@hostname.tld:port/resource */
cl_git_pass(git_net_url_parse(&conndata,
@@ -166,12 +202,78 @@ void test_network_url_parse__hostname_user_pass_port(void)
cl_assert_equal_s(conndata.path, "/resource");
cl_assert_equal_s(conndata.username, "user");
cl_assert_equal_s(conndata.password, "pass");
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_p(conndata.fragment, NULL);
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
+}
+
+void test_url_parse__hostname_user_pass_port_query(void)
+{
+ /* user:pass@hostname.tld:port/resource */
+ cl_git_pass(git_net_url_parse(&conndata,
+ "https://user:pass@example.com:9191/resource?query=q&foo=bar&z=asdf"));
+ cl_assert_equal_s(conndata.scheme, "https");
+ cl_assert_equal_s(conndata.host, "example.com");
+ cl_assert_equal_s(conndata.port, "9191");
+ cl_assert_equal_s(conndata.path, "/resource");
+ cl_assert_equal_s(conndata.username, "user");
+ cl_assert_equal_s(conndata.password, "pass");
+ cl_assert_equal_s(conndata.query, "query=q&foo=bar&z=asdf");
+ cl_assert_equal_p(conndata.fragment, NULL);
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
+}
+
+void test_url_parse__hostname_user_pass_port_fragment(void)
+{
+ /* user:pass@hostname.tld:port/resource */
+ cl_git_pass(git_net_url_parse(&conndata,
+ "https://user:pass@example.com:9191/resource#fragment"));
+ cl_assert_equal_s(conndata.scheme, "https");
+ cl_assert_equal_s(conndata.host, "example.com");
+ cl_assert_equal_s(conndata.port, "9191");
+ cl_assert_equal_s(conndata.path, "/resource");
+ cl_assert_equal_s(conndata.username, "user");
+ cl_assert_equal_s(conndata.password, "pass");
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_s(conndata.fragment, "fragment");
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
+}
+
+void test_url_parse__hostname_user_pass_port_query_fragment(void)
+{
+ /* user:pass@hostname.tld:port/resource */
+ cl_git_pass(git_net_url_parse(&conndata,
+ "https://user:pass@example.com:9191/resource?query=q&foo=bar&z=asdf#fragment"));
+ cl_assert_equal_s(conndata.scheme, "https");
+ cl_assert_equal_s(conndata.host, "example.com");
+ cl_assert_equal_s(conndata.port, "9191");
+ cl_assert_equal_s(conndata.path, "/resource");
+ cl_assert_equal_s(conndata.username, "user");
+ cl_assert_equal_s(conndata.password, "pass");
+ cl_assert_equal_s(conndata.query, "query=q&foo=bar&z=asdf");
+ cl_assert_equal_s(conndata.fragment, "fragment");
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
+}
+
+void test_url_parse__fragment_with_question_mark(void)
+{
+ /* user:pass@hostname.tld:port/resource */
+ cl_git_pass(git_net_url_parse(&conndata,
+ "https://user:pass@example.com:9191/resource#fragment_with?question_mark"));
+ cl_assert_equal_s(conndata.scheme, "https");
+ cl_assert_equal_s(conndata.host, "example.com");
+ cl_assert_equal_s(conndata.port, "9191");
+ cl_assert_equal_s(conndata.path, "/resource");
+ cl_assert_equal_s(conndata.username, "user");
+ cl_assert_equal_s(conndata.password, "pass");
+ cl_assert_equal_p(conndata.query, NULL);
+ cl_assert_equal_s(conndata.fragment, "fragment_with?question_mark");
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
/* IPv4 addresses */
-void test_network_url_parse__ipv4_trivial(void)
+void test_url_parse__ipv4_trivial(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1/resource"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -183,7 +285,7 @@ void test_network_url_parse__ipv4_trivial(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv4_root(void)
+void test_url_parse__ipv4_root(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1/"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -195,7 +297,7 @@ void test_network_url_parse__ipv4_root(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv4_implied_root(void)
+void test_url_parse__ipv4_implied_root(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -207,7 +309,7 @@ void test_network_url_parse__ipv4_implied_root(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv4_implied_root_custom_port(void)
+void test_url_parse__ipv4_implied_root_custom_port(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:42"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -219,7 +321,7 @@ void test_network_url_parse__ipv4_implied_root_custom_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__ipv4_implied_root_empty_port(void)
+void test_url_parse__ipv4_implied_root_empty_port(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -231,7 +333,7 @@ void test_network_url_parse__ipv4_implied_root_empty_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv4_encoded_password(void)
+void test_url_parse__ipv4_encoded_password(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass%2fis%40bad@192.168.1.1:1234/"));
@@ -244,7 +346,7 @@ void test_network_url_parse__ipv4_encoded_password(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__ipv4_user(void)
+void test_url_parse__ipv4_user(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user@192.168.1.1/resource"));
@@ -257,7 +359,7 @@ void test_network_url_parse__ipv4_user(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv4_user_pass(void)
+void test_url_parse__ipv4_user_pass(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass@192.168.1.1/resource"));
@@ -270,7 +372,7 @@ void test_network_url_parse__ipv4_user_pass(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv4_port(void)
+void test_url_parse__ipv4_port(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://192.168.1.1:9191/resource"));
@@ -283,7 +385,7 @@ void test_network_url_parse__ipv4_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__ipv4_empty_port(void)
+void test_url_parse__ipv4_empty_port(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:/resource"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -295,7 +397,7 @@ void test_network_url_parse__ipv4_empty_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv4_user_port(void)
+void test_url_parse__ipv4_user_port(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user@192.168.1.1:9191/resource"));
@@ -308,7 +410,7 @@ void test_network_url_parse__ipv4_user_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__ipv4_user_pass_port(void)
+void test_url_parse__ipv4_user_pass_port(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass@192.168.1.1:9191/resource"));
@@ -323,7 +425,7 @@ void test_network_url_parse__ipv4_user_pass_port(void)
/* IPv6 addresses */
-void test_network_url_parse__ipv6_trivial(void)
+void test_url_parse__ipv6_trivial(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]/resource"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -335,7 +437,7 @@ void test_network_url_parse__ipv6_trivial(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv6_root(void)
+void test_url_parse__ipv6_root(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]/"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -347,7 +449,7 @@ void test_network_url_parse__ipv6_root(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv6_implied_root(void)
+void test_url_parse__ipv6_implied_root(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -359,7 +461,7 @@ void test_network_url_parse__ipv6_implied_root(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv6_implied_root_custom_port(void)
+void test_url_parse__ipv6_implied_root_custom_port(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:42"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -371,7 +473,7 @@ void test_network_url_parse__ipv6_implied_root_custom_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__ipv6_implied_root_empty_port(void)
+void test_url_parse__ipv6_implied_root_empty_port(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -383,7 +485,7 @@ void test_network_url_parse__ipv6_implied_root_empty_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv6_encoded_password(void)
+void test_url_parse__ipv6_encoded_password(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass%2fis%40bad@[fe80::dcad:beff:fe00:0001]:1234/"));
@@ -396,7 +498,7 @@ void test_network_url_parse__ipv6_encoded_password(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__ipv6_user(void)
+void test_url_parse__ipv6_user(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user@[fe80::dcad:beff:fe00:0001]/resource"));
@@ -409,7 +511,7 @@ void test_network_url_parse__ipv6_user(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv6_user_pass(void)
+void test_url_parse__ipv6_user_pass(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass@[fe80::dcad:beff:fe00:0001]/resource"));
@@ -422,7 +524,7 @@ void test_network_url_parse__ipv6_user_pass(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv6_port(void)
+void test_url_parse__ipv6_port(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://[fe80::dcad:beff:fe00:0001]:9191/resource"));
@@ -435,7 +537,7 @@ void test_network_url_parse__ipv6_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__ipv6_empty_port(void)
+void test_url_parse__ipv6_empty_port(void)
{
cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:/resource"));
cl_assert_equal_s(conndata.scheme, "http");
@@ -447,7 +549,7 @@ void test_network_url_parse__ipv6_empty_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_parse__ipv6_user_port(void)
+void test_url_parse__ipv6_user_port(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user@[fe80::dcad:beff:fe00:0001]:9191/resource"));
@@ -460,7 +562,7 @@ void test_network_url_parse__ipv6_user_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__ipv6_user_pass_port(void)
+void test_url_parse__ipv6_user_pass_port(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user:pass@[fe80::dcad:beff:fe00:0001]:9191/resource"));
@@ -473,7 +575,7 @@ void test_network_url_parse__ipv6_user_pass_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_parse__ipv6_invalid_addresses(void)
+void test_url_parse__ipv6_invalid_addresses(void)
{
/* Opening bracket missing */
cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
@@ -526,6 +628,7 @@ void test_network_url_parse__ipv6_invalid_addresses(void)
"https://user@[fe80::dcad:beff:fe00:0001:9191/resource"));
cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
"https://user:pass@[fe80::dcad:beff:fe00:0001:9191/resource"));
+
/* Both brackets missing */
cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
"http://fe80::dcad:beff:fe00:0001/resource"));
@@ -554,4 +657,135 @@ void test_network_url_parse__ipv6_invalid_addresses(void)
/* Invalid character inside address */
cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata, "http://[fe8o::dcad:beff:fe00:0001]/resource"));
+
+ /* Characters before/after braces */
+ cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
+ "http://fe80::[dcad:beff:fe00:0001]/resource"));
+ cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
+ "http://cafe[fe80::dcad:beff:fe00:0001]/resource"));
+ cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
+ "http://[fe80::dcad:beff:fe00:0001]cafe/resource"));
+}
+
+/* Oddities */
+
+void test_url_parse__invalid_scheme_is_relative(void)
+{
+ cl_git_pass(git_net_url_parse(&conndata, "foo!bar://host:42/path/to/project?query_string=yes"));
+ cl_assert_equal_p(conndata.scheme, NULL);
+ cl_assert_equal_p(conndata.host, NULL);
+ cl_assert_equal_p(conndata.port, NULL);
+ cl_assert_equal_s(conndata.path, "foo!bar://host:42/path/to/project");
+ cl_assert_equal_p(conndata.username, NULL);
+ cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_s(conndata.query, "query_string=yes");
+ cl_assert_equal_p(conndata.fragment, NULL);
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
+}
+
+void test_url_parse__scheme_case_is_normalized(void)
+{
+ cl_git_pass(git_net_url_parse(&conndata, "GIT+SSH://host:42/path/to/project"));
+ cl_assert_equal_s(conndata.scheme, "git+ssh");
+}
+
+void test_url_parse__nonhierarchical_scheme(void)
+{
+ cl_git_pass(git_net_url_parse(&conndata, "mailto:foobar@example.com"));
+ cl_assert_equal_s(conndata.scheme, "mailto");
+ cl_assert_equal_p(conndata.host, NULL);
+ cl_assert_equal_p(conndata.port, NULL);
+ cl_assert_equal_s(conndata.path, "foobar@example.com");
+ cl_assert_equal_p(conndata.username, NULL);
+ cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
+}
+
+void test_url_parse__no_scheme_relative_path(void)
+{
+ cl_git_pass(git_net_url_parse(&conndata, "path"));
+ cl_assert_equal_p(conndata.scheme, NULL);
+ cl_assert_equal_p(conndata.host, NULL);
+ cl_assert_equal_p(conndata.port, NULL);
+ cl_assert_equal_s(conndata.path, "path");
+ cl_assert_equal_p(conndata.username, NULL);
+ cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
+}
+
+void test_url_parse__no_scheme_absolute_path(void)
+{
+ cl_git_pass(git_net_url_parse(&conndata, "/path"));
+ cl_assert_equal_p(conndata.scheme, NULL);
+ cl_assert_equal_p(conndata.host, NULL);
+ cl_assert_equal_p(conndata.port, NULL);
+ cl_assert_equal_s(conndata.path, "/path");
+ cl_assert_equal_p(conndata.username, NULL);
+ cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
+}
+
+void test_url_parse__empty_path(void)
+{
+ cl_git_pass(git_net_url_parse(&conndata, "mailto:"));
+ cl_assert_equal_s(conndata.scheme, "mailto");
+ cl_assert_equal_p(conndata.host, NULL);
+ cl_assert_equal_p(conndata.port, NULL);
+ cl_assert_equal_s(conndata.path, NULL);
+ cl_assert_equal_p(conndata.username, NULL);
+ cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
+}
+
+void test_url_parse__empty_path_with_empty_authority(void)
+{
+ cl_git_pass(git_net_url_parse(&conndata, "http://"));
+ cl_assert_equal_s(conndata.scheme, "http");
+ cl_assert_equal_p(conndata.host, NULL);
+ cl_assert_equal_s(conndata.port, "80");
+ cl_assert_equal_s(conndata.path, "/");
+ cl_assert_equal_p(conndata.username, NULL);
+ cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
+}
+
+void test_url_parse__http_follows_the_rfc(void)
+{
+ cl_git_fail(git_net_url_parse(&conndata, "https://my.email.address@gmail.com@source.developers.google.com:4433/p/my-project/r/my-repository"));
+}
+
+void test_url_parse__ssh_from_terrible_google_rfc_violating_products(void)
+{
+ cl_git_pass(git_net_url_parse(&conndata, "ssh://my.email.address@gmail.com@source.developers.google.com:2022/p/my-project/r/my-repository"));
+ cl_assert_equal_s(conndata.scheme, "ssh");
+ cl_assert_equal_s(conndata.host, "source.developers.google.com");
+ cl_assert_equal_s(conndata.port, "2022");
+ cl_assert_equal_s(conndata.path, "/p/my-project/r/my-repository");
+ cl_assert_equal_s(conndata.username, "my.email.address@gmail.com");
+ cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
+}
+
+void test_url_parse__ssh_with_password_from_terrible_google_rfc_violating_products(void)
+{
+ cl_git_pass(git_net_url_parse(&conndata, "ssh://my.email.address@gmail.com:seekret@source.developers.google.com:2022/p/my-project/r/my-repository"));
+ cl_assert_equal_s(conndata.scheme, "ssh");
+ cl_assert_equal_s(conndata.host, "source.developers.google.com");
+ cl_assert_equal_s(conndata.port, "2022");
+ cl_assert_equal_s(conndata.path, "/p/my-project/r/my-repository");
+ cl_assert_equal_s(conndata.username, "my.email.address@gmail.com");
+ cl_assert_equal_s(conndata.password, "seekret");
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
+}
+
+void test_url_parse__spaces_in_the_name(void)
+{
+ cl_git_pass(git_net_url_parse(&conndata, "https://libgit2@dev.azure.com/libgit2/test/_git/spaces%20in%20the%20name"));
+ cl_assert_equal_s(conndata.scheme, "https");
+ cl_assert_equal_s(conndata.host, "dev.azure.com");
+ cl_assert_equal_s(conndata.port, "443");
+ cl_assert_equal_s(conndata.path, "/libgit2/test/_git/spaces%20in%20the%20name");
+ cl_assert_equal_s(conndata.username, "libgit2");
+ cl_assert_equal_p(conndata.password, NULL);
+ cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
diff --git a/tests/libgit2/network/url/pattern.c b/tests/util/url/pattern.c
index 5e4495f70..f183d7f5f 100644
--- a/tests/libgit2/network/url/pattern.c
+++ b/tests/util/url/pattern.c
@@ -7,7 +7,7 @@ struct url_pattern {
bool matches;
};
-void test_network_url_pattern__single(void)
+void test_url_pattern__single(void)
{
git_net_url url;
size_t i;
@@ -53,7 +53,7 @@ void test_network_url_pattern__single(void)
}
}
-void test_network_url_pattern__list(void)
+void test_url_pattern__list(void)
{
git_net_url url;
size_t i;
diff --git a/tests/libgit2/network/url/redirect.c b/tests/util/url/redirect.c
index a94db7daf..540177861 100644
--- a/tests/libgit2/network/url/redirect.c
+++ b/tests/util/url/redirect.c
@@ -4,17 +4,17 @@
static git_net_url conndata;
-void test_network_url_redirect__initialize(void)
+void test_url_redirect__initialize(void)
{
memset(&conndata, 0, sizeof(conndata));
}
-void test_network_url_redirect__cleanup(void)
+void test_url_redirect__cleanup(void)
{
git_net_url_dispose(&conndata);
}
-void test_network_url_redirect__redirect_http(void)
+void test_url_redirect__redirect_http(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"http://example.com/foo/bar/baz"));
@@ -28,7 +28,7 @@ void test_network_url_redirect__redirect_http(void)
cl_assert_equal_p(conndata.password, NULL);
}
-void test_network_url_redirect__redirect_ssl(void)
+void test_url_redirect__redirect_ssl(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://example.com/foo/bar/baz"));
@@ -42,7 +42,7 @@ void test_network_url_redirect__redirect_ssl(void)
cl_assert_equal_p(conndata.password, NULL);
}
-void test_network_url_redirect__redirect_leaves_root_path(void)
+void test_url_redirect__redirect_leaves_root_path(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://example.com/foo/bar/baz"));
@@ -56,7 +56,7 @@ void test_network_url_redirect__redirect_leaves_root_path(void)
cl_assert_equal_p(conndata.password, NULL);
}
-void test_network_url_redirect__redirect_encoded_username_password(void)
+void test_url_redirect__redirect_encoded_username_password(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://user%2fname:pass%40word%zyx%v@example.com/foo/bar/baz"));
@@ -70,7 +70,7 @@ void test_network_url_redirect__redirect_encoded_username_password(void)
cl_assert_equal_s(conndata.password, "pass@word%zyx%v");
}
-void test_network_url_redirect__redirect_cross_host_allowed(void)
+void test_url_redirect__redirect_cross_host_allowed(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://bar.com/bar/baz"));
@@ -84,7 +84,7 @@ void test_network_url_redirect__redirect_cross_host_allowed(void)
cl_assert_equal_p(conndata.password, NULL);
}
-void test_network_url_redirect__redirect_cross_host_denied(void)
+void test_url_redirect__redirect_cross_host_denied(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://bar.com/bar/baz"));
@@ -92,7 +92,7 @@ void test_network_url_redirect__redirect_cross_host_denied(void)
"https://foo.com/bar/baz", false, NULL), -1);
}
-void test_network_url_redirect__redirect_http_downgrade_denied(void)
+void test_url_redirect__redirect_http_downgrade_denied(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://foo.com/bar/baz"));
@@ -100,7 +100,7 @@ void test_network_url_redirect__redirect_http_downgrade_denied(void)
"http://foo.com/bar/baz", true, NULL), -1);
}
-void test_network_url_redirect__redirect_relative(void)
+void test_url_redirect__redirect_relative(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"http://foo.com/bar/baz/biff"));
@@ -114,7 +114,7 @@ void test_network_url_redirect__redirect_relative(void)
cl_assert_equal_p(conndata.password, NULL);
}
-void test_network_url_redirect__redirect_relative_ssl(void)
+void test_url_redirect__redirect_relative_ssl(void)
{
cl_git_pass(git_net_url_parse(&conndata,
"https://foo.com/bar/baz/biff"));
@@ -128,7 +128,7 @@ void test_network_url_redirect__redirect_relative_ssl(void)
cl_assert_equal_p(conndata.password, NULL);
}
-void test_network_url_redirect__service_query_no_query_params_in_location(void)
+void test_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"));
@@ -137,7 +137,7 @@ void test_network_url_redirect__service_query_no_query_params_in_location(void)
cl_assert_equal_s(conndata.path, "/baz");
}
-void test_network_url_redirect__service_query_with_query_params_in_location(void)
+void test_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"));
diff --git a/tests/libgit2/network/url/scp.c b/tests/util/url/scp.c
index 8cdc832ae..0e0dce17e 100644
--- a/tests/libgit2/network/url/scp.c
+++ b/tests/util/url/scp.c
@@ -3,19 +3,19 @@
static git_net_url conndata;
-void test_network_url_scp__initialize(void)
+void test_url_scp__initialize(void)
{
memset(&conndata, 0, sizeof(conndata));
}
-void test_network_url_scp__cleanup(void)
+void test_url_scp__cleanup(void)
{
git_net_url_dispose(&conndata);
}
/* Hostname */
-void test_network_url_scp__hostname_trivial(void)
+void test_url_scp__hostname_trivial(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "example.com:/resource"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -27,7 +27,7 @@ void test_network_url_scp__hostname_trivial(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__hostname_bracketed(void)
+void test_url_scp__hostname_bracketed(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[example.com]:/resource"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -39,7 +39,7 @@ void test_network_url_scp__hostname_bracketed(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__hostname_root(void)
+void test_url_scp__hostname_root(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "example.com:/"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -51,7 +51,7 @@ void test_network_url_scp__hostname_root(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__hostname_user(void)
+void test_url_scp__hostname_user(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "git@example.com:/resource"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -63,7 +63,7 @@ void test_network_url_scp__hostname_user(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__hostname_user_bracketed(void)
+void test_url_scp__hostname_user_bracketed(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[git@example.com]:/resource"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -75,7 +75,7 @@ void test_network_url_scp__hostname_user_bracketed(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__hostname_port(void)
+void test_url_scp__hostname_port(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[example.com:42]:/resource"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -87,7 +87,7 @@ void test_network_url_scp__hostname_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_scp__hostname_user_port(void)
+void test_url_scp__hostname_user_port(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[git@example.com:42]:/resource"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -99,7 +99,7 @@ void test_network_url_scp__hostname_user_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_scp__ipv4_trivial(void)
+void test_url_scp__ipv4_trivial(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "192.168.99.88:/resource/a/b/c"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -111,7 +111,7 @@ void test_network_url_scp__ipv4_trivial(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__ipv4_bracketed(void)
+void test_url_scp__ipv4_bracketed(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[192.168.99.88]:/resource/a/b/c"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -123,7 +123,7 @@ void test_network_url_scp__ipv4_bracketed(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__ipv4_user(void)
+void test_url_scp__ipv4_user(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "git@192.168.99.88:/resource/a/b/c"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -135,7 +135,7 @@ void test_network_url_scp__ipv4_user(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__ipv4_port(void)
+void test_url_scp__ipv4_port(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[192.168.99.88:1111]:/resource/a/b/c"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -147,7 +147,7 @@ void test_network_url_scp__ipv4_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_scp__ipv4_user_port(void)
+void test_url_scp__ipv4_user_port(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[git@192.168.99.88:1111]:/resource/a/b/c"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -159,7 +159,7 @@ void test_network_url_scp__ipv4_user_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_scp__ipv6_trivial(void)
+void test_url_scp__ipv6_trivial(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[fe80::dcad:beff:fe00:0001]:/resource/foo"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -171,7 +171,7 @@ void test_network_url_scp__ipv6_trivial(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__ipv6_user(void)
+void test_url_scp__ipv6_user(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "git@[fe80::dcad:beff:fe00:0001]:/resource/foo"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -183,7 +183,7 @@ void test_network_url_scp__ipv6_user(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__ipv6_port(void)
+void test_url_scp__ipv6_port(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[[fe80::dcad:beff:fe00:0001]:99]:/resource/foo"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -195,7 +195,7 @@ void test_network_url_scp__ipv6_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_scp__ipv6_user_port(void)
+void test_url_scp__ipv6_user_port(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[git@[fe80::dcad:beff:fe00:0001]:99]:/resource/foo"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -207,7 +207,7 @@ void test_network_url_scp__ipv6_user_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
}
-void test_network_url_scp__hexhost_and_port(void)
+void test_url_scp__hexhost_and_port(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[fe:22]:/resource/foo"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -219,7 +219,7 @@ void test_network_url_scp__hexhost_and_port(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__malformed_ipv6_one(void)
+void test_url_scp__malformed_ipv6_one(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "fe80::dcad:beff:fe00:0001]:/resource"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -231,7 +231,7 @@ void test_network_url_scp__malformed_ipv6_one(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__malformed_ipv6_two(void)
+void test_url_scp__malformed_ipv6_two(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "[fe80::dcad:beff:fe00:0001]:42]:/resource"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -243,7 +243,7 @@ void test_network_url_scp__malformed_ipv6_two(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__malformed_ipv6_with_user(void)
+void test_url_scp__malformed_ipv6_with_user(void)
{
cl_git_pass(git_net_url_parse_scp(&conndata, "git@[fe80::dcad:beff:fe00:0001]:42]:/resource"));
cl_assert_equal_s(conndata.scheme, "ssh");
@@ -255,7 +255,7 @@ void test_network_url_scp__malformed_ipv6_with_user(void)
cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
}
-void test_network_url_scp__invalid_addresses(void)
+void test_url_scp__invalid_addresses(void)
{
/* Path is required */
cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse_scp(&conndata,
@@ -314,8 +314,4 @@ void test_network_url_scp__invalid_addresses(void)
"[git@[fe80::dcad:beff:fe00:0001]:42:/resource"));
cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse_scp(&conndata,
"[git@[fe80::dcad:beff:fe00:0001:42]:/resource"));
-
- /* Invalid character inside address */
- cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
- "[fe8o::dcad:beff:fe00:0001]:/resource"));
}
diff --git a/tests/libgit2/network/url/valid.c b/tests/util/url/valid.c
index 2b2cb7ba4..797b697bd 100644
--- a/tests/libgit2/network/url/valid.c
+++ b/tests/util/url/valid.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "net.h"
-void test_network_url_valid__test(void)
+void test_url_valid__test(void)
{
cl_assert(git_net_str_is_url("http://example.com/"));
cl_assert(git_net_str_is_url("file://localhost/tmp/foo/"));