From 1782038144ef3413831801bb9c2f3038a84ac6f4 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Thu, 14 Nov 2013 14:05:52 -0800 Subject: Rename tests-clar to tests --- tests/refs/shorthand.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/refs/shorthand.c (limited to 'tests/refs/shorthand.c') diff --git a/tests/refs/shorthand.c b/tests/refs/shorthand.c new file mode 100644 index 000000000..f995d26ca --- /dev/null +++ b/tests/refs/shorthand.c @@ -0,0 +1,27 @@ +#include "clar_libgit2.h" + +#include "repository.h" + +void assert_shorthand(git_repository *repo, const char *refname, const char *shorthand) +{ + git_reference *ref; + + cl_git_pass(git_reference_lookup(&ref, repo, refname)); + cl_assert_equal_s(git_reference_shorthand(ref), shorthand); + git_reference_free(ref); +} + +void test_refs_shorthand__0(void) +{ + git_repository *repo; + + cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git"))); + + + assert_shorthand(repo, "refs/heads/master", "master"); + assert_shorthand(repo, "refs/tags/test", "test"); + assert_shorthand(repo, "refs/remotes/test/master", "test/master"); + assert_shorthand(repo, "refs/notes/fanout", "notes/fanout"); + + git_repository_free(repo); +} -- cgit v1.2.1