diff options
author | Nikolai Vladimirov <nikolay@vladimiroff.com> | 2013-08-25 16:59:50 +0400 |
---|---|---|
committer | Nikolai Vladimirov <nikolay@vladimiroff.com> | 2013-08-26 09:04:10 +0400 |
commit | 504850cdf56190a61782abfec37f3533b42d769e (patch) | |
tree | a2a1009690f4b65a8989a34182faa2b979f17a1f /tests-clar/refs | |
parent | a07db1a1e03c42da5e9132c86776cb5c1ab89214 (diff) |
refs: add git_reference_is_tag
Diffstat (limited to 'tests-clar/refs')
-rw-r--r-- | tests-clar/refs/read.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests-clar/refs/read.c b/tests-clar/refs/read.c index afb6be008..35cf17e9e 100644 --- a/tests-clar/refs/read.c +++ b/tests-clar/refs/read.c @@ -255,6 +255,22 @@ void test_refs_read__can_determine_if_a_reference_is_a_local_branch(void) assert_is_branch("refs/tags/e90810b", false); } +static void assert_is_tag(const char *name, bool expected_tagness) +{ + git_reference *reference; + cl_git_pass(git_reference_lookup(&reference, g_repo, name)); + cl_assert_equal_i(expected_tagness, git_reference_is_tag(reference)); + git_reference_free(reference); +} + +void test_refs_read__can_determine_if_a_reference_is_a_tag(void) +{ + assert_is_tag("refs/tags/e90810b", true); + assert_is_tag("refs/tags/test", true); + assert_is_tag("refs/heads/packed", false); + assert_is_tag("refs/remotes/test/master", false); +} + void test_refs_read__invalid_name_returns_EINVALIDSPEC(void) { git_reference *reference; |