summaryrefslogtreecommitdiff
path: root/tests/refs
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2014-01-29 10:35:46 -0800
committerBen Straub <bs@github.com>2014-01-30 15:53:52 -0800
commita1710a28f684298f79a0bab08b0b8930c1d57cf0 (patch)
tree6393f7683112593c502bbd8f6b4612fd213fca6c /tests/refs
parenta1b07dca7d456b5eb1f32e6f25c4f419752778b3 (diff)
downloadlibgit2-a1710a28f684298f79a0bab08b0b8930c1d57cf0.tar.gz
Enhance testing of signature parameters
Diffstat (limited to 'tests/refs')
-rw-r--r--tests/refs/branches/create.c12
-rw-r--r--tests/refs/branches/move.c13
-rw-r--r--tests/refs/rename.c7
3 files changed, 28 insertions, 4 deletions
diff --git a/tests/refs/branches/create.c b/tests/refs/branches/create.c
index 32e17d600..06dcca591 100644
--- a/tests/refs/branches/create.c
+++ b/tests/refs/branches/create.c
@@ -78,22 +78,30 @@ void test_refs_branches_create__creation_creates_new_reflog(void)
{
git_reflog *log;
const git_reflog_entry *entry;
+ git_signature *sig;
+
+ cl_git_pass(git_signature_now(&sig, "me", "foo@example.com"));
retrieve_known_commit(&target, repo);
- cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false, NULL, "create!"));
+ cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false, sig, "create!"));
cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME));
cl_assert_equal_i(1, git_reflog_entrycount(log));
entry = git_reflog_entry_byindex(log, 0);
cl_assert_equal_s("create!", git_reflog_entry_message(entry));
+ cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email);
git_reflog_free(log);
+ git_signature_free(sig);
}
void test_refs_branches_create__default_reflog_message(void)
{
git_reflog *log;
const git_reflog_entry *entry;
+ git_signature *sig;
+
+ cl_git_pass(git_signature_default(&sig, repo));
retrieve_known_commit(&target, repo);
cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false, NULL, NULL));
@@ -101,6 +109,8 @@ void test_refs_branches_create__default_reflog_message(void)
entry = git_reflog_entry_byindex(log, 0);
cl_assert_equal_s("Branch: created", git_reflog_entry_message(entry));
+ cl_assert_equal_s(sig->email, git_reflog_entry_committer(entry)->email);
git_reflog_free(log);
+ git_signature_free(sig);
}
diff --git a/tests/refs/branches/move.c b/tests/refs/branches/move.c
index 622921d4f..3d2c815ae 100644
--- a/tests/refs/branches/move.c
+++ b/tests/refs/branches/move.c
@@ -193,17 +193,22 @@ void test_refs_branches_move__updates_the_reflog(void)
git_reference *new_branch;
git_reflog *log;
const git_reflog_entry *entry;
+ git_signature *sig;
+
+ cl_git_pass(git_signature_now(&sig, "me", "foo@example.com"));
cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master"));
- cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0, NULL, "message"));
+ cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0, sig, "message"));
cl_git_pass(git_reflog_read(&log, repo, git_reference_name(new_branch)));
entry = git_reflog_entry_byindex(log, 0);
cl_assert_equal_s("message", git_reflog_entry_message(entry));
+ cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email);
git_reference_free(branch);
git_reference_free(new_branch);
git_reflog_free(log);
+ git_signature_free(sig);
}
void test_refs_branches_move__default_reflog_message(void)
@@ -212,6 +217,9 @@ void test_refs_branches_move__default_reflog_message(void)
git_reference *new_branch;
git_reflog *log;
const git_reflog_entry *entry;
+ git_signature *sig;
+
+ cl_git_pass(git_signature_default(&sig, repo));
cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master"));
cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0, NULL, NULL));
@@ -220,9 +228,10 @@ void test_refs_branches_move__default_reflog_message(void)
entry = git_reflog_entry_byindex(log, 0);
cl_assert_equal_s("Branch: renamed refs/heads/master to refs/heads/master2",
git_reflog_entry_message(entry));
+ cl_assert_equal_s(sig->email, git_reflog_entry_committer(entry)->email);
git_reference_free(branch);
git_reference_free(new_branch);
git_reflog_free(log);
-
+ git_signature_free(sig);
}
diff --git a/tests/refs/rename.c b/tests/refs/rename.c
index 63f202cbf..88f0afd9c 100644
--- a/tests/refs/rename.c
+++ b/tests/refs/rename.c
@@ -371,15 +371,20 @@ void test_refs_rename__writes_to_reflog(void)
git_reference *ref, *new_ref;
git_reflog *log;
const git_reflog_entry *entry;
+ git_signature *sig;
+
+ cl_git_pass(git_signature_now(&sig, "me", "foo@example.com"));
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_git_pass(git_reference_rename(&new_ref, ref, ref_one_name_new, false,
- NULL, "message"));
+ sig, "message"));
cl_git_pass(git_reflog_read(&log, g_repo, git_reference_name(new_ref)));
entry = git_reflog_entry_byindex(log, 0);
cl_assert_equal_s("message", git_reflog_entry_message(entry));
+ cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email);
git_reflog_free(log);
git_reference_free(ref);
git_reference_free(new_ref);
+ git_signature_free(sig);
}