diff options
Diffstat (limited to 'tests/odb/loose.c')
-rw-r--r-- | tests/odb/loose.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/odb/loose.c b/tests/odb/loose.c index a85f1430d..c91927c4a 100644 --- a/tests/odb/loose.c +++ b/tests/odb/loose.c @@ -66,19 +66,25 @@ void test_odb_loose__cleanup(void) void test_odb_loose__exists(void) { - git_oid id, id2; + git_oid id, id2; git_odb *odb; - write_object_files(&one); + write_object_files(&one); cl_git_pass(git_odb_open(&odb, "test-objects")); - cl_git_pass(git_oid_fromstr(&id, one.id)); + cl_git_pass(git_oid_fromstr(&id, one.id)); + cl_assert(git_odb_exists(odb, &id)); - cl_assert(git_odb_exists(odb, &id)); + cl_git_pass(git_oid_fromstrp(&id, "8b137891")); + cl_git_pass(git_odb_exists_prefix(&id2, odb, &id, 8)); + cl_assert_equal_i(0, git_oid_streq(&id2, one.id)); - /* Test for a non-existant object */ - cl_git_pass(git_oid_fromstr(&id2, "8b137891791fe96927ad78e64b0aad7bded08baa")); - cl_assert(!git_odb_exists(odb, &id2)); + /* Test for a missing object */ + cl_git_pass(git_oid_fromstr(&id, "8b137891791fe96927ad78e64b0aad7bded08baa")); + cl_assert(!git_odb_exists(odb, &id)); + + cl_git_pass(git_oid_fromstrp(&id, "8b13789a")); + cl_assert_equal_i(GIT_ENOTFOUND, git_odb_exists_prefix(&id2, odb, &id, 8)); git_odb_free(odb); } |