diff options
author | Vicent Marti <tanoku@gmail.com> | 2013-04-07 09:22:38 +0400 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2013-04-07 09:22:38 +0400 |
commit | d9ecaf8c6f2d2d538319174e42e5c98585c902e5 (patch) | |
tree | ae3d0bee5061af1bf35fbda34f2afc2757365ee2 /tests-clar/refs | |
parent | 2274483727b62ae155d7206668713d5346756de6 (diff) | |
parent | 2e2332857d26c7dbed3e4b940bb571da348bb5c7 (diff) |
Merge remote-tracking branch 'gnprice/revwalk' into development
Diffstat (limited to 'tests-clar/refs')
-rw-r--r-- | tests-clar/refs/revparse.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests-clar/refs/revparse.c b/tests-clar/refs/revparse.c index e0bccf4a9..705014c2a 100644 --- a/tests-clar/refs/revparse.c +++ b/tests-clar/refs/revparse.c @@ -32,6 +32,33 @@ static void test_object(const char *spec, const char *expected_oid) test_object_inrepo(spec, expected_oid, g_repo); } +static void test_rangelike(const char *rangelike, + const char *expected_left, + const char *expected_right, + int expected_threedots) +{ + char objstr[64] = {0}; + git_object *left, *right; + int threedots; + int error; + + error = git_revparse_rangelike(&left, &right, &threedots, g_repo, rangelike); + + if (expected_left != NULL) { + cl_assert_equal_i(0, error); + cl_assert_equal_i(threedots, expected_threedots); + git_oid_fmt(objstr, git_object_id(left)); + cl_assert_equal_s(objstr, expected_left); + git_oid_fmt(objstr, git_object_id(right)); + cl_assert_equal_s(objstr, expected_right); + } else + cl_assert(error != 0); + + git_object_free(left); + git_object_free(right); +} + + void test_refs_revparse__initialize(void) { cl_git_pass(git_repository_open(&g_repo, cl_fixture("testrepo.git"))); @@ -596,3 +623,19 @@ void test_refs_revparse__try_to_retrieve_branch_before_abbrev_sha(void) git_object_free(target); cl_git_sandbox_cleanup(); } + + +void test_refs_revparse__range(void) +{ + test_rangelike("be3563a^1..be3563a", + "9fd738e8f7967c078dceed8190330fc8648ee56a", + "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", + 0); + + test_rangelike("be3563a^1...be3563a", + "9fd738e8f7967c078dceed8190330fc8648ee56a", + "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", + 1); + + test_rangelike("be3563a^1.be3563a", NULL, NULL, 0); +} |