Commit 7be5104d by Ben Straub

Add tests for badly-formed URLs

parent f93f3790
...@@ -56,13 +56,9 @@ void test_clone_nonetwork__bad_urls(void) ...@@ -56,13 +56,9 @@ void test_clone_nonetwork__bad_urls(void)
cl_assert(!git_path_exists("./foo")); cl_assert(!git_path_exists("./foo"));
cl_git_fail(git_clone(&g_repo, "git://example.com:asdf", "./foo", &g_options)); 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_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) void test_clone_nonetwork__do_not_clean_existing_directory(void)
......
...@@ -31,6 +31,13 @@ void test_network_urlparse__trivial(void) ...@@ -31,6 +31,13 @@ void test_network_urlparse__trivial(void)
cl_assert_equal_p(pass, NULL); 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) void test_network_urlparse__user(void)
{ {
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass, cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
......
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