mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
tests: ensure branches are really deleted
Our branch deletion tests merely ensure that `git_branch_delete` returns `GIT_OK`. Actually test that the branch is deleted.
This commit is contained in:
@@ -54,6 +54,8 @@ void test_refs_branches_delete__can_delete_a_branch_even_if_HEAD_is_missing(void
|
||||
cl_git_pass(git_branch_lookup(&branch, repo, "br2", GIT_BRANCH_LOCAL));
|
||||
cl_git_pass(git_branch_delete(branch));
|
||||
git_reference_free(branch);
|
||||
|
||||
cl_git_fail_with(GIT_ENOTFOUND, git_branch_lookup(&branch, repo, "br2", GIT_BRANCH_LOCAL));
|
||||
}
|
||||
|
||||
void test_refs_branches_delete__can_delete_a_branch_when_HEAD_is_unborn(void)
|
||||
@@ -65,6 +67,8 @@ void test_refs_branches_delete__can_delete_a_branch_when_HEAD_is_unborn(void)
|
||||
cl_git_pass(git_branch_lookup(&branch, repo, "br2", GIT_BRANCH_LOCAL));
|
||||
cl_git_pass(git_branch_delete(branch));
|
||||
git_reference_free(branch);
|
||||
|
||||
cl_git_fail_with(GIT_ENOTFOUND, git_branch_lookup(&branch, repo, "br2", GIT_BRANCH_LOCAL));
|
||||
}
|
||||
|
||||
void test_refs_branches_delete__can_delete_a_branch_pointed_at_by_detached_HEAD(void)
|
||||
@@ -82,6 +86,8 @@ void test_refs_branches_delete__can_delete_a_branch_pointed_at_by_detached_HEAD(
|
||||
cl_git_pass(git_branch_lookup(&branch, repo, "master", GIT_BRANCH_LOCAL));
|
||||
cl_git_pass(git_branch_delete(branch));
|
||||
git_reference_free(branch);
|
||||
|
||||
cl_git_fail_with(GIT_ENOTFOUND, git_branch_lookup(&branch, repo, "master", GIT_BRANCH_LOCAL));
|
||||
}
|
||||
|
||||
void test_refs_branches_delete__can_delete_a_local_branch(void)
|
||||
@@ -90,6 +96,8 @@ void test_refs_branches_delete__can_delete_a_local_branch(void)
|
||||
cl_git_pass(git_branch_lookup(&branch, repo, "br2", GIT_BRANCH_LOCAL));
|
||||
cl_git_pass(git_branch_delete(branch));
|
||||
git_reference_free(branch);
|
||||
|
||||
cl_git_fail_with(GIT_ENOTFOUND, git_branch_lookup(&branch, repo, "br2", GIT_BRANCH_LOCAL));
|
||||
}
|
||||
|
||||
void test_refs_branches_delete__can_delete_a_remote_branch(void)
|
||||
@@ -98,6 +106,8 @@ void test_refs_branches_delete__can_delete_a_remote_branch(void)
|
||||
cl_git_pass(git_branch_lookup(&branch, repo, "nulltoken/master", GIT_BRANCH_REMOTE));
|
||||
cl_git_pass(git_branch_delete(branch));
|
||||
git_reference_free(branch);
|
||||
|
||||
cl_git_fail_with(GIT_ENOTFOUND, git_branch_lookup(&branch, repo, "nulltoken/master", GIT_BRANCH_LOCAL));
|
||||
}
|
||||
|
||||
void test_refs_branches_delete__deleting_a_branch_removes_related_configuration_data(void)
|
||||
|
||||
Reference in New Issue
Block a user