Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-03-23 01:52:29 +0400
committerRussell Belfer <rb@github.com>2013-03-26 01:03:16 +0400
commit1098cfaecae823ede02881f995f18aee2908b89f (patch)
tree22699f76e42c99732c72a453cf5e716588af1525 /tests-clar/index/tests.c
parentb8acb775e25c76f07dac8855ad0a88b37f7b2f17 (diff)
Test fixes and cleanup
This fixes some places where the new tests were leaving the test area in a bad state or were freeing data they should not free. It also removes code that is extraneous to the core issue and fixes an invalid SHA being looked up in one of the tests (which was failing, but for the wrong reason).
Diffstat (limited to 'tests-clar/index/tests.c')
-rw-r--r--tests-clar/index/tests.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/tests-clar/index/tests.c b/tests-clar/index/tests.c
index 49defd03f..88e374e6e 100644
--- a/tests-clar/index/tests.c
+++ b/tests-clar/index/tests.c
@@ -251,21 +251,24 @@ void test_index_tests__add(void)
git_repository_free(repo);
}
+static void cleanup_1397(void *opaque)
+{
+ GIT_UNUSED(opaque);
+ cl_git_sandbox_cleanup();
+}
+
void test_index_tests__add_issue_1397(void)
{
git_index *index;
- git_config *cfg;
git_repository *repo;
const git_index_entry *entry;
git_oid id1;
- cl_set_cleanup(&cleanup_myrepo, NULL);
+ cl_set_cleanup(&cleanup_1397, NULL);
repo = cl_git_sandbox_init("issue_1397");
- cl_git_pass(git_repository_config(&cfg, repo));
- cl_git_pass(git_config_set_bool(cfg, "core.autocrlf", true));
- git_config_free(cfg);
+ cl_repo_set_bool(repo, "core.autocrlf", true);
/* Ensure we're the only guy in the room */
cl_git_pass(git_repository_index(&index, repo));
@@ -278,17 +281,16 @@ void test_index_tests__add_issue_1397(void)
/* Make sure the initial SHA-1 is correct */
cl_assert((entry = git_index_get_bypath(index, "crlf_file.txt", 0)) != NULL);
- cl_assert(git_oid_cmp(&id1, &entry->oid) == 0);
+ cl_assert_(git_oid_cmp(&id1, &entry->oid) == 0, "first oid check");
/* Update the index */
cl_git_pass(git_index_add_bypath(index, "crlf_file.txt"));
/* Check the new SHA-1 */
cl_assert((entry = git_index_get_bypath(index, "crlf_file.txt", 0)) != NULL);
- cl_assert(git_oid_cmp(&id1, &entry->oid) == 0);
+ cl_assert_(git_oid_cmp(&id1, &entry->oid) == 0, "second oid check");
git_index_free(index);
- git_repository_free(repo);
}
void test_index_tests__add_bypath_to_a_bare_repository_returns_EBAREPO(void)