diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2019-02-25 09:25:34 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-25 09:25:34 +0000 |
| commit | 68729289213bf211ebd0c1b5f8a39648629a8693 (patch) | |
| tree | 35516357c9cb177d3e3bedb74f6a17028ebf513e /tests | |
| parent | 5a6a3c00acbd42038b50d830c7dd4a0c5c52052c (diff) | |
| parent | c5d8e3006d98023d1540f1404b28a5db1ca0ecd2 (diff) | |
| download | libgit2-68729289213bf211ebd0c1b5f8a39648629a8693.tar.gz | |
Merge pull request #5000 from augfab/branch_lookup_all
Have git_branch_lookup accept GIT_BRANCH_ALL
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/refs/branches/lookup.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/refs/branches/lookup.c b/tests/refs/branches/lookup.c index 95d49a4b3..ef0c1f97d 100644 --- a/tests/refs/branches/lookup.c +++ b/tests/refs/branches/lookup.c @@ -20,20 +20,41 @@ void test_refs_branches_lookup__cleanup(void) repo = NULL; } -void test_refs_branches_lookup__can_retrieve_a_local_branch(void) +void test_refs_branches_lookup__can_retrieve_a_local_branch_local(void) { cl_git_pass(git_branch_lookup(&branch, repo, "br2", GIT_BRANCH_LOCAL)); } -void test_refs_branches_lookup__can_retrieve_a_remote_tracking_branch(void) +void test_refs_branches_lookup__can_retrieve_a_local_branch_all(void) +{ + cl_git_pass(git_branch_lookup(&branch, repo, "br2", GIT_BRANCH_ALL)); +} + +void test_refs_branches_lookup__trying_to_retrieve_a_local_branch_remote(void) +{ + cl_git_fail(git_branch_lookup(&branch, repo, "br2", GIT_BRANCH_REMOTE)); +} + +void test_refs_branches_lookup__can_retrieve_a_remote_tracking_branch_remote(void) { cl_git_pass(git_branch_lookup(&branch, repo, "test/master", GIT_BRANCH_REMOTE)); } +void test_refs_branches_lookup__can_retrieve_a_remote_tracking_branch_all(void) +{ + cl_git_pass(git_branch_lookup(&branch, repo, "test/master", GIT_BRANCH_ALL)); +} + +void test_refs_branches_lookup__trying_to_retrieve_a_remote_tracking_branch_local(void) +{ + cl_git_fail(git_branch_lookup(&branch, repo, "test/master", GIT_BRANCH_LOCAL)); +} + void test_refs_branches_lookup__trying_to_retrieve_an_unknown_branch_returns_ENOTFOUND(void) { cl_assert_equal_i(GIT_ENOTFOUND, git_branch_lookup(&branch, repo, "where/are/you", GIT_BRANCH_LOCAL)); cl_assert_equal_i(GIT_ENOTFOUND, git_branch_lookup(&branch, repo, "over/here", GIT_BRANCH_REMOTE)); + cl_assert_equal_i(GIT_ENOTFOUND, git_branch_lookup(&branch, repo, "maybe/here", GIT_BRANCH_ALL)); } void test_refs_branches_lookup__trying_to_retrieve_a_branch_with_an_invalid_name_returns_EINVALIDSPEC(void) @@ -42,4 +63,6 @@ void test_refs_branches_lookup__trying_to_retrieve_a_branch_with_an_invalid_name git_branch_lookup(&branch, repo, "are/you/inv@{id", GIT_BRANCH_LOCAL)); cl_assert_equal_i(GIT_EINVALIDSPEC, git_branch_lookup(&branch, repo, "yes/i am", GIT_BRANCH_REMOTE)); + cl_assert_equal_i(GIT_EINVALIDSPEC, + git_branch_lookup(&branch, repo, "inv al/id", GIT_BRANCH_ALL)); } |
