From 19313a76b66c7af027f21340d7055dd9ba7dcd0c Mon Sep 17 00:00:00 2001 From: nulltoken Date: Mon, 23 Jan 2012 21:27:29 +0100 Subject: [PATCH] remote: add test which creates a basic remote entry in the repository configuration then loads the remote --- tests-clay/network/createremotethenload.c | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests-clay/network/createremotethenload.c diff --git a/tests-clay/network/createremotethenload.c b/tests-clay/network/createremotethenload.c new file mode 100644 index 000000000..16d430e7e --- /dev/null +++ b/tests-clay/network/createremotethenload.c @@ -0,0 +1,33 @@ +#include "clay_libgit2.h" + +static git_remote *_remote; +static git_repository *_repo; +static git_config *_config; +static char url[] = "http://github.com/libgit2/libgit2.git"; + +void test_network_createremotethenload__initialize(void) +{ + cl_fixture_sandbox("testrepo.git"); + + cl_git_pass(git_repository_open(&_repo, "testrepo.git")); + + cl_git_pass(git_repository_config(&_config, _repo)); + cl_git_pass(git_config_set_string(_config, "remote.origin.fetch", "+refs/heads/*:refs/remotes/origin/*")); + cl_git_pass(git_config_set_string(_config, "remote.origin.url", url)); + git_config_free(_config); + + cl_git_pass(git_remote_load(&_remote, _repo, "origin")); +} + +void test_network_createremotethenload__cleanup(void) +{ + git_remote_free(_remote); + git_repository_free(_repo); + cl_fixture_cleanup("testrepo.git"); +} + +void test_network_createremotethenload__parsing(void) +{ + cl_assert(!strcmp(git_remote_name(_remote), "origin")); + cl_assert(!strcmp(git_remote_url(_remote), url)); +}