summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-08-31 21:53:42 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-08-31 21:53:42 +0200
commit05ac70514fed0ae75ba2844f22b233da1c25b8cc (patch)
tree4bb93a9d77c431b5b0a03f9a373164135a2543f7
parentba67c0752269ba06523fe7f5fa350e6328b20241 (diff)
downloadlibgit2-05ac70514fed0ae75ba2844f22b233da1c25b8cc.tar.gz
remote: test for supported URLs in a single place
Instead of using ifdefs to run the tests, use them to set when we expect to support a particular scheme and always have the tests in the code.
-rw-r--r--tests/network/remote/remotes.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/tests/network/remote/remotes.c b/tests/network/remote/remotes.c
index 1d5d318c5..45f2a795f 100644
--- a/tests/network/remote/remotes.c
+++ b/tests/network/remote/remotes.c
@@ -91,31 +91,24 @@ void test_network_remote_remotes__error_when_no_push_available(void)
git_remote_free(r);
}
-void test_network_remote_remotes__supported_transport_methods_are_supported(void)
+void test_network_remote_remotes__supported_urls(void)
{
- cl_assert(git_remote_supported_url("git://github.com/libgit2/libgit2"));
- cl_assert(git_remote_supported_url("http://github.com/libgit2/libgit2"));
+ int ssh_supported = 0, https_supported = 0;
#ifdef GIT_SSH
- cl_assert(git_remote_supported_url("git@github.com:libgit2/libgit2.git"));
- cl_assert(git_remote_supported_url("ssh://git@github.com/libgit2/libgit2.git"));
+ ssh_supported = 1;
#endif
#if defined(GIT_SSL) || defined(GIT_WINHTTP)
- cl_assert(git_remote_supported_url("https://git@github.com/libgit2/libgit2.git"));
+ https_supported = 1;
#endif
-}
-void test_network_remote_remotes__unsupported_transport_methods_are_unsupported(void)
-{
-#ifndef GIT_SSH
- cl_assert(!git_remote_supported_url("git@github.com:libgit2/libgit2.git"));
- cl_assert(!git_remote_supported_url("ssh://git@github.com/libgit2/libgit2.git"));
-#endif
+ cl_assert(git_remote_supported_url("git://github.com/libgit2/libgit2"));
+ cl_assert(git_remote_supported_url("http://github.com/libgit2/libgit2"));
-#if !defined(GIT_SSL) && !defined(GIT_WINHTTP)
- cl_assert(!git_remote_supported_url("https://git@github.com/libgit2/libgit2.git"));
-#endif
+ cl_assert_equal_i(ssh_supported, git_remote_supported_url("git@github.com:libgit2/libgit2.git"));
+ cl_assert_equal_i(ssh_supported, git_remote_supported_url("ssh://git@github.com/libgit2/libgit2.git"));
+ cl_assert_equal_i(https_supported, git_remote_supported_url("https://github.com/libgit2/libgit2.git"));
}
void test_network_remote_remotes__refspec_parsing(void)