summaryrefslogtreecommitdiff
path: root/tests/network/urlparse.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-07-03 02:34:32 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-07-03 02:34:32 +0200
commit1380e7c6b1b802efdbbe48edf706e49cc309f370 (patch)
treea6ee9e18f5fdbc6e45a333e98f39e41fad8d0fae /tests/network/urlparse.c
parent28f087c8642ff9c8dd6964e101e6d8539db6281a (diff)
downloadlibgit2-cmn/http-url-path.tar.gz
netops: error out on url without a pathcmn/http-url-path
In order to connect to a remote server, we need to provide a path to the repository we're interested in. Consider the lack of path in the url an error.
Diffstat (limited to 'tests/network/urlparse.c')
-rw-r--r--tests/network/urlparse.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/network/urlparse.c b/tests/network/urlparse.c
index 2a9c2f69f..b3ac8ae60 100644
--- a/tests/network/urlparse.c
+++ b/tests/network/urlparse.c
@@ -33,6 +33,24 @@ void test_network_urlparse__trivial(void)
cl_assert_equal_p(pass, NULL);
}
+void test_network_urlparse__root(void)
+{
+ cl_git_pass(gitno_extract_url_parts(&host, &port, &path, &user, &pass,
+ "http://example.com/", "8080"));
+ cl_assert_equal_s(host, "example.com");
+ cl_assert_equal_s(port, "8080");
+ cl_assert_equal_s(path, "/");
+ cl_assert_equal_p(user, NULL);
+ cl_assert_equal_p(pass, NULL);
+}
+
+void test_network_urlparse__just_hostname(void)
+{
+ cl_git_fail_with(GIT_EINVALIDSPEC,
+ gitno_extract_url_parts(&host, &port, &path, &user, &pass,
+ "http://example.com", "8080"));
+}
+
void test_network_urlparse__encoded_password(void)
{
cl_git_pass(gitno_extract_url_parts(&host, &port, &path, &user, &pass,