Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
f73f760e
Commit
f73f760e
authored
Sep 20, 2012
by
Sascha Cunz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests::Object::Tag: move listing tags tests to an own file
parent
3af06254
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
45 deletions
+60
-45
tests-clar/object/tag/list.c
+60
-0
tests-clar/object/tag/read.c
+0
-45
No files found.
tests-clar/object/tag/list.c
0 → 100644
View file @
f73f760e
#include "clar_libgit2.h"
#include "tag.h"
static
git_repository
*
g_repo
;
// Helpers
static
void
ensure_tag_pattern_match
(
git_repository
*
repo
,
const
char
*
pattern
,
const
size_t
expected_matches
)
{
git_strarray
tag_list
;
int
error
=
0
;
if
((
error
=
git_tag_list_match
(
&
tag_list
,
pattern
,
repo
))
<
0
)
goto
exit
;
if
(
tag_list
.
count
!=
expected_matches
)
error
=
GIT_ERROR
;
exit:
git_strarray_free
(
&
tag_list
);
cl_git_pass
(
error
);
}
// Fixture setup and teardown
void
test_object_tag_list__initialize
(
void
)
{
g_repo
=
cl_git_sandbox_init
(
"testrepo"
);
}
void
test_object_tag_list__cleanup
(
void
)
{
cl_git_sandbox_cleanup
();
}
void
test_object_tag_list__list_all
(
void
)
{
// list all tag names from the repository
git_strarray
tag_list
;
cl_git_pass
(
git_tag_list
(
&
tag_list
,
g_repo
));
cl_assert
(
tag_list
.
count
==
3
);
git_strarray_free
(
&
tag_list
);
}
void
test_object_tag_list__list_by_pattern
(
void
)
{
// list all tag names from the repository matching a specified pattern
ensure_tag_pattern_match
(
g_repo
,
""
,
3
);
ensure_tag_pattern_match
(
g_repo
,
"*"
,
3
);
ensure_tag_pattern_match
(
g_repo
,
"t*"
,
1
);
ensure_tag_pattern_match
(
g_repo
,
"*b"
,
2
);
ensure_tag_pattern_match
(
g_repo
,
"e"
,
0
);
ensure_tag_pattern_match
(
g_repo
,
"e90810b"
,
1
);
ensure_tag_pattern_match
(
g_repo
,
"e90810[ab]"
,
1
);
}
tests-clar/object/tag/read.c
View file @
f73f760e
...
...
@@ -10,27 +10,6 @@ static const char *badly_tagged_commit = "e90810b8df3e80c413d903f631643c71688713
static
git_repository
*
g_repo
;
// Helpers
static
void
ensure_tag_pattern_match
(
git_repository
*
repo
,
const
char
*
pattern
,
const
size_t
expected_matches
)
{
git_strarray
tag_list
;
int
error
=
0
;
if
((
error
=
git_tag_list_match
(
&
tag_list
,
pattern
,
repo
))
<
0
)
goto
exit
;
if
(
tag_list
.
count
!=
expected_matches
)
error
=
GIT_ERROR
;
exit:
git_strarray_free
(
&
tag_list
);
cl_git_pass
(
error
);
}
// Fixture setup and teardown
void
test_object_tag_read__initialize
(
void
)
{
...
...
@@ -74,30 +53,6 @@ void test_object_tag_read__parse(void)
git_commit_free
(
commit
);
}
void
test_object_tag_read__list
(
void
)
{
// list all tag names from the repository
git_strarray
tag_list
;
cl_git_pass
(
git_tag_list
(
&
tag_list
,
g_repo
));
cl_assert
(
tag_list
.
count
==
3
);
git_strarray_free
(
&
tag_list
);
}
void
test_object_tag_read__list_pattern
(
void
)
{
// list all tag names from the repository matching a specified pattern
ensure_tag_pattern_match
(
g_repo
,
""
,
3
);
ensure_tag_pattern_match
(
g_repo
,
"*"
,
3
);
ensure_tag_pattern_match
(
g_repo
,
"t*"
,
1
);
ensure_tag_pattern_match
(
g_repo
,
"*b"
,
2
);
ensure_tag_pattern_match
(
g_repo
,
"e"
,
0
);
ensure_tag_pattern_match
(
g_repo
,
"e90810b"
,
1
);
ensure_tag_pattern_match
(
g_repo
,
"e90810[ab]"
,
1
);
}
void
test_object_tag_read__parse_without_tagger
(
void
)
{
// read and parse a tag without a tagger field
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment