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
5a5bd640
Commit
5a5bd640
authored
Mar 31, 2013
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: Fix indentations
parent
81b8c9df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
61 deletions
+61
-61
tests-clar/object/tag/read.c
+61
-61
No files found.
tests-clar/object/tag/read.c
View file @
5a5bd640
...
@@ -15,105 +15,105 @@ static git_repository *g_repo;
...
@@ -15,105 +15,105 @@ static git_repository *g_repo;
// Fixture setup and teardown
// Fixture setup and teardown
void
test_object_tag_read__initialize
(
void
)
void
test_object_tag_read__initialize
(
void
)
{
{
g_repo
=
cl_git_sandbox_init
(
"testrepo"
);
g_repo
=
cl_git_sandbox_init
(
"testrepo"
);
}
}
void
test_object_tag_read__cleanup
(
void
)
void
test_object_tag_read__cleanup
(
void
)
{
{
cl_git_sandbox_cleanup
();
cl_git_sandbox_cleanup
();
}
}
void
test_object_tag_read__parse
(
void
)
void
test_object_tag_read__parse
(
void
)
{
{
// read and parse a tag from the repository
// read and parse a tag from the repository
git_tag
*
tag1
,
*
tag2
;
git_tag
*
tag1
,
*
tag2
;
git_commit
*
commit
;
git_commit
*
commit
;
git_oid
id1
,
id2
,
id_commit
;
git_oid
id1
,
id2
,
id_commit
;
git_oid_fromstr
(
&
id1
,
tag1_id
);
git_oid_fromstr
(
&
id1
,
tag1_id
);
git_oid_fromstr
(
&
id2
,
tag2_id
);
git_oid_fromstr
(
&
id2
,
tag2_id
);
git_oid_fromstr
(
&
id_commit
,
tagged_commit
);
git_oid_fromstr
(
&
id_commit
,
tagged_commit
);
cl_git_pass
(
git_tag_lookup
(
&
tag1
,
g_repo
,
&
id1
));
cl_git_pass
(
git_tag_lookup
(
&
tag1
,
g_repo
,
&
id1
));
cl_assert_equal_s
(
git_tag_name
(
tag1
),
"test"
);
cl_assert_equal_s
(
git_tag_name
(
tag1
),
"test"
);
cl_assert
(
git_tag_target_type
(
tag1
)
==
GIT_OBJ_TAG
);
cl_assert
(
git_tag_target_type
(
tag1
)
==
GIT_OBJ_TAG
);
cl_git_pass
(
git_tag_target
((
git_object
**
)
&
tag2
,
tag1
));
cl_git_pass
(
git_tag_target
((
git_object
**
)
&
tag2
,
tag1
));
cl_assert
(
tag2
!=
NULL
);
cl_assert
(
tag2
!=
NULL
);
cl_assert
(
git_oid_cmp
(
&
id2
,
git_tag_id
(
tag2
))
==
0
);
cl_assert
(
git_oid_cmp
(
&
id2
,
git_tag_id
(
tag2
))
==
0
);
cl_git_pass
(
git_tag_target
((
git_object
**
)
&
commit
,
tag2
));
cl_git_pass
(
git_tag_target
((
git_object
**
)
&
commit
,
tag2
));
cl_assert
(
commit
!=
NULL
);
cl_assert
(
commit
!=
NULL
);
cl_assert
(
git_oid_cmp
(
&
id_commit
,
git_commit_id
(
commit
))
==
0
);
cl_assert
(
git_oid_cmp
(
&
id_commit
,
git_commit_id
(
commit
))
==
0
);
git_tag_free
(
tag1
);
git_tag_free
(
tag1
);
git_tag_free
(
tag2
);
git_tag_free
(
tag2
);
git_commit_free
(
commit
);
git_commit_free
(
commit
);
}
}
void
test_object_tag_read__parse_without_tagger
(
void
)
void
test_object_tag_read__parse_without_tagger
(
void
)
{
{
// read and parse a tag without a tagger field
// read and parse a tag without a tagger field
git_repository
*
bad_tag_repo
;
git_repository
*
bad_tag_repo
;
git_tag
*
bad_tag
;
git_tag
*
bad_tag
;
git_commit
*
commit
;
git_commit
*
commit
;
git_oid
id
,
id_commit
;
git_oid
id
,
id_commit
;
// TODO: This is a little messy
// TODO: This is a little messy
cl_git_pass
(
git_repository_open
(
&
bad_tag_repo
,
cl_fixture
(
"bad_tag.git"
)));
cl_git_pass
(
git_repository_open
(
&
bad_tag_repo
,
cl_fixture
(
"bad_tag.git"
)));
git_oid_fromstr
(
&
id
,
bad_tag_id
);
git_oid_fromstr
(
&
id
,
bad_tag_id
);
git_oid_fromstr
(
&
id_commit
,
badly_tagged_commit
);
git_oid_fromstr
(
&
id_commit
,
badly_tagged_commit
);
cl_git_pass
(
git_tag_lookup
(
&
bad_tag
,
bad_tag_repo
,
&
id
));
cl_git_pass
(
git_tag_lookup
(
&
bad_tag
,
bad_tag_repo
,
&
id
));
cl_assert
(
bad_tag
!=
NULL
);
cl_assert
(
bad_tag
!=
NULL
);
cl_assert_equal_s
(
git_tag_name
(
bad_tag
),
"e90810b"
);
cl_assert_equal_s
(
git_tag_name
(
bad_tag
),
"e90810b"
);
cl_assert
(
git_oid_cmp
(
&
id
,
git_tag_id
(
bad_tag
))
==
0
);
cl_assert
(
git_oid_cmp
(
&
id
,
git_tag_id
(
bad_tag
))
==
0
);
cl_assert
(
bad_tag
->
tagger
==
NULL
);
cl_assert
(
bad_tag
->
tagger
==
NULL
);
cl_git_pass
(
git_tag_target
((
git_object
**
)
&
commit
,
bad_tag
));
cl_git_pass
(
git_tag_target
((
git_object
**
)
&
commit
,
bad_tag
));
cl_assert
(
commit
!=
NULL
);
cl_assert
(
commit
!=
NULL
);
cl_assert
(
git_oid_cmp
(
&
id_commit
,
git_commit_id
(
commit
))
==
0
);
cl_assert
(
git_oid_cmp
(
&
id_commit
,
git_commit_id
(
commit
))
==
0
);
git_tag_free
(
bad_tag
);
git_tag_free
(
bad_tag
);
git_commit_free
(
commit
);
git_commit_free
(
commit
);
git_repository_free
(
bad_tag_repo
);
git_repository_free
(
bad_tag_repo
);
}
}
void
test_object_tag_read__parse_without_message
(
void
)
void
test_object_tag_read__parse_without_message
(
void
)
{
{
// read and parse a tag without a message field
// read and parse a tag without a message field
git_repository
*
short_tag_repo
;
git_repository
*
short_tag_repo
;
git_tag
*
short_tag
;
git_tag
*
short_tag
;
git_commit
*
commit
;
git_commit
*
commit
;
git_oid
id
,
id_commit
;
git_oid
id
,
id_commit
;
// TODO: This is a little messy
// TODO: This is a little messy
cl_git_pass
(
git_repository_open
(
&
short_tag_repo
,
cl_fixture
(
"short_tag.git"
)));
cl_git_pass
(
git_repository_open
(
&
short_tag_repo
,
cl_fixture
(
"short_tag.git"
)));
git_oid_fromstr
(
&
id
,
short_tag_id
);
git_oid_fromstr
(
&
id
,
short_tag_id
);
git_oid_fromstr
(
&
id_commit
,
short_tagged_commit
);
git_oid_fromstr
(
&
id_commit
,
short_tagged_commit
);
cl_git_pass
(
git_tag_lookup
(
&
short_tag
,
short_tag_repo
,
&
id
));
cl_git_pass
(
git_tag_lookup
(
&
short_tag
,
short_tag_repo
,
&
id
));
cl_assert
(
short_tag
!=
NULL
);
cl_assert
(
short_tag
!=
NULL
);
cl_assert_equal_s
(
git_tag_name
(
short_tag
),
"no_description"
);
cl_assert_equal_s
(
git_tag_name
(
short_tag
),
"no_description"
);
cl_assert
(
git_oid_cmp
(
&
id
,
git_tag_id
(
short_tag
))
==
0
);
cl_assert
(
git_oid_cmp
(
&
id
,
git_tag_id
(
short_tag
))
==
0
);
cl_assert
(
short_tag
->
message
==
NULL
);
cl_assert
(
short_tag
->
message
==
NULL
);
cl_git_pass
(
git_tag_target
((
git_object
**
)
&
commit
,
short_tag
));
cl_git_pass
(
git_tag_target
((
git_object
**
)
&
commit
,
short_tag
));
cl_assert
(
commit
!=
NULL
);
cl_assert
(
commit
!=
NULL
);
cl_assert
(
git_oid_cmp
(
&
id_commit
,
git_commit_id
(
commit
))
==
0
);
cl_assert
(
git_oid_cmp
(
&
id_commit
,
git_commit_id
(
commit
))
==
0
);
git_tag_free
(
short_tag
);
git_tag_free
(
short_tag
);
git_commit_free
(
commit
);
git_commit_free
(
commit
);
git_repository_free
(
short_tag_repo
);
git_repository_free
(
short_tag_repo
);
}
}
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