summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/libgit2/refs/cmp.c27
-rw-r--r--tests/resources/testrepo2/.gitted/refs/heads/symbolic-one1
-rw-r--r--tests/resources/testrepo2/.gitted/refs/heads/symbolic-two1
3 files changed, 29 insertions, 0 deletions
diff --git a/tests/libgit2/refs/cmp.c b/tests/libgit2/refs/cmp.c
new file mode 100644
index 000000000..78d90b04a
--- /dev/null
+++ b/tests/libgit2/refs/cmp.c
@@ -0,0 +1,27 @@
+#include "clar_libgit2.h"
+#include "refs.h"
+
+static git_repository *g_repo;
+
+void test_refs_cmp__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo2");
+}
+
+void test_refs_cmp__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+void test_refs_cmp__symbolic(void)
+{
+ git_reference *one, *two;
+
+ cl_git_pass(git_reference_lookup(&one, g_repo, "refs/heads/symbolic-one"));
+ cl_git_pass(git_reference_lookup(&two, g_repo, "refs/heads/symbolic-two"));
+
+ cl_assert(git_reference_cmp(one, two) != 0);
+
+ git_reference_free(one);
+ git_reference_free(two);
+}
diff --git a/tests/resources/testrepo2/.gitted/refs/heads/symbolic-one b/tests/resources/testrepo2/.gitted/refs/heads/symbolic-one
new file mode 100644
index 000000000..cb089cd89
--- /dev/null
+++ b/tests/resources/testrepo2/.gitted/refs/heads/symbolic-one
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests/resources/testrepo2/.gitted/refs/heads/symbolic-two b/tests/resources/testrepo2/.gitted/refs/heads/symbolic-two
new file mode 100644
index 000000000..cb089cd89
--- /dev/null
+++ b/tests/resources/testrepo2/.gitted/refs/heads/symbolic-two
@@ -0,0 +1 @@
+ref: refs/heads/master