Add tests for badly-formed URLs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/tests-clar/clone/nonetwork.c b/tests-clar/clone/nonetwork.c
index 9eb4bf9..90e1e64 100644
--- a/tests-clar/clone/nonetwork.c
+++ b/tests-clar/clone/nonetwork.c
@@ -56,13 +56,9 @@ void test_clone_nonetwork__bad_urls(void)
cl_assert(!git_path_exists("./foo"));
cl_git_fail(git_clone(&g_repo, "git://example.com:asdf", "./foo", &g_options));
- cl_assert(!git_path_exists("./foo"));
- cl_git_fail(git_clone(&g_repo, "git://example.com:asdf/foo", "./foo", &g_options));
- cl_assert(!git_path_exists("./foo"));
- cl_git_fail(git_clone(&g_repo, "https://example.com:asdf", "./foo", &g_options));
- cl_assert(!git_path_exists("./foo"));
cl_git_fail(git_clone(&g_repo, "https://example.com:asdf/foo", "./foo", &g_options));
- cl_assert(!git_path_exists("./foo"));
+ cl_git_fail(git_clone(&g_repo, "git://github.com/git://github.com/foo/bar.git.git",
+ "./bar", &g_options));
}
void test_clone_nonetwork__do_not_clean_existing_directory(void)
diff --git a/tests-clar/network/urlparse.c b/tests-clar/network/urlparse.c
index 274d7e9..15e841b 100644
--- a/tests-clar/network/urlparse.c
+++ b/tests-clar/network/urlparse.c
@@ -31,6 +31,13 @@ void test_network_urlparse__trivial(void)
cl_assert_equal_p(pass, NULL);
}
+void test_network_urlparse__bad_url(void)
+{
+ cl_git_fail_with(gitno_extract_url_parts(&host, &port, &user, &pass,
+ "github.com/git://github.com/foo/bar.git.git", "443"),
+ GIT_EINVALIDSPEC);
+}
+
void test_network_urlparse__user(void)
{
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,