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
5a74d160
Commit
5a74d160
authored
Apr 23, 2011
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merged pull request #135 from carlosmn/valgrind.
Fix memory leaks in the tests
parents
7df49e9e
1bfa053e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
1 deletions
+23
-1
tests/t04-commit.c
+10
-1
tests/t09-tree.c
+8
-0
tests/t10-refs.c
+4
-0
tests/test_lib.c
+1
-0
No files found.
tests/t04-commit.c
View file @
5a74d160
...
...
@@ -368,7 +368,7 @@ BEGIN_TEST(details0, "query the details on a parsed commit")
const
char
*
message
,
*
message_short
;
git_time_t
commit_time
;
unsigned
int
parents
,
p
;
git_commit
*
parent
;
git_commit
*
parent
=
NULL
,
*
old_parent
=
NULL
;
git_oid_mkstr
(
&
id
,
commit_ids
[
i
]);
...
...
@@ -390,11 +390,19 @@ BEGIN_TEST(details0, "query the details on a parsed commit")
must_be_true
(
commit_time
>
0
);
must_be_true
(
parents
<=
2
);
for
(
p
=
0
;
p
<
parents
;
p
++
)
{
if
(
old_parent
!=
NULL
)
git_commit_close
(
old_parent
);
old_parent
=
parent
;
must_pass
(
git_commit_parent
(
&
parent
,
commit
,
p
));
must_be_true
(
parent
!=
NULL
);
must_be_true
(
git_commit_author
(
parent
)
!=
NULL
);
// is it really a commit?
}
git_commit_close
(
old_parent
);
git_commit_close
(
parent
);
must_fail
(
git_commit_parent
(
&
parent
,
commit
,
parents
));
git_commit_close
(
commit
);
}
git_repository_free
(
repo
);
...
...
@@ -462,6 +470,7 @@ BEGIN_TEST(write0, "write a new commit object from memory to disk")
must_pass
(
remove_loose_object
(
REPOSITORY_FOLDER
,
(
git_object
*
)
commit
));
git_commit_close
(
commit
);
git_repository_free
(
repo
);
END_TEST
...
...
tests/t09-tree.c
View file @
5a74d160
...
...
@@ -82,6 +82,7 @@ BEGIN_TEST(read0, "acces randomly the entries on a loaded tree")
must_be_true
(
git_tree_entry_byindex
(
tree
,
3
)
==
NULL
);
must_be_true
(
git_tree_entry_byindex
(
tree
,
-
1
)
==
NULL
);
git_tree_close
(
tree
);
git_repository_free
(
repo
);
END_TEST
...
...
@@ -102,7 +103,9 @@ BEGIN_TEST(read1, "read a tree from the repository")
/* GH-86: git_object_lookup() should also check the type if the object comes from the cache */
must_be_true
(
git_object_lookup
(
&
obj
,
repo
,
&
id
,
GIT_OBJ_TREE
)
==
0
);
git_object_close
(
obj
);
must_be_true
(
git_object_lookup
(
&
obj
,
repo
,
&
id
,
GIT_OBJ_BLOB
)
==
GIT_EINVALIDTYPE
);
git_object_close
(
obj
);
entry
=
git_tree_entry_byname
(
tree
,
"README"
);
must_be_true
(
entry
!=
NULL
);
...
...
@@ -111,6 +114,8 @@ BEGIN_TEST(read1, "read a tree from the repository")
must_pass
(
git_tree_entry_2object
(
&
obj
,
repo
,
entry
));
git_object_close
(
obj
);
git_tree_close
(
tree
);
git_repository_free
(
repo
);
END_TEST
...
...
@@ -148,6 +153,9 @@ BEGIN_TEST(write2, "write a tree from a memory")
must_pass
(
git_treebuilder_write
(
&
rid
,
repo
,
builder
));
must_be_true
(
git_oid_cmp
(
&
rid
,
&
id2
)
==
0
);
git_treebuilder_free
(
builder
);
git_tree_close
(
tree
);
close_temp_repo
(
repo
);
END_TEST
...
...
tests/t10-refs.c
View file @
5a74d160
...
...
@@ -51,6 +51,7 @@ BEGIN_TEST(readtag0, "lookup a loose tag reference")
git__joinpath
(
ref_name_from_tag_name
,
GIT_REFS_TAGS_DIR
,
git_tag_name
((
git_tag
*
)
object
));
must_be_true
(
strcmp
(
ref_name_from_tag_name
,
loose_tag_ref_name
)
==
0
);
git_object_close
(
object
);
git_repository_free
(
repo
);
END_TEST
...
...
@@ -91,6 +92,7 @@ BEGIN_TEST(readsym0, "lookup a symbolic reference")
git_oid_mkstr
(
&
id
,
current_master_tip
);
must_be_true
(
git_oid_cmp
(
&
id
,
git_object_id
(
object
))
==
0
);
git_object_close
(
object
);
git_repository_free
(
repo
);
END_TEST
...
...
@@ -117,6 +119,7 @@ BEGIN_TEST(readsym1, "lookup a nested symbolic reference")
git_oid_mkstr
(
&
id
,
current_master_tip
);
must_be_true
(
git_oid_cmp
(
&
id
,
git_object_id
(
object
))
==
0
);
git_object_close
(
object
);
git_repository_free
(
repo
);
END_TEST
...
...
@@ -175,6 +178,7 @@ BEGIN_TEST(readpacked0, "lookup a packed reference")
must_be_true
(
object
!=
NULL
);
must_be_true
(
git_object_type
(
object
)
==
GIT_OBJ_COMMIT
);
git_object_close
(
object
);
git_repository_free
(
repo
);
END_TEST
...
...
tests/test_lib.c
View file @
5a74d160
...
...
@@ -130,6 +130,7 @@ static void free_suite(git_testsuite *ts)
if
(
ts
->
list
[
n
])
test_free
(
ts
->
list
[
n
]);
free
(
ts
->
name
);
free
(
ts
);
}
...
...
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