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
8152a748
Commit
8152a748
authored
Mar 22, 2016
by
Marc Strapetz
Committed by
Edward Thomson
Mar 24, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iterator: more pathlist-related tests should test actual paths
parent
9eb9e5fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
tests/iterator/tree.c
+17
-5
tests/iterator/workdir.c
+6
-1
No files found.
tests/iterator/tree.c
View file @
8152a748
...
@@ -979,6 +979,13 @@ void test_iterator_tree__pathlist_with_directory(void)
...
@@ -979,6 +979,13 @@ void test_iterator_tree__pathlist_with_directory(void)
git_vector
filelist
;
git_vector
filelist
;
git_tree
*
tree
;
git_tree
*
tree
;
const
char
*
expected
[]
=
{
"subdir/README"
,
"subdir/new.txt"
,
"subdir/subdir2/README"
,
"subdir/subdir2/new.txt"
};
size_t
expected_len
=
4
;
const
char
*
expected2
[]
=
{
"subdir/subdir2/README"
,
"subdir/subdir2/new.txt"
};
size_t
expected_len2
=
2
;
g_repo
=
cl_git_sandbox_init
(
"testrepo2"
);
g_repo
=
cl_git_sandbox_init
(
"testrepo2"
);
git_repository_head_tree
(
&
tree
,
g_repo
);
git_repository_head_tree
(
&
tree
,
g_repo
);
...
@@ -987,9 +994,10 @@ void test_iterator_tree__pathlist_with_directory(void)
...
@@ -987,9 +994,10 @@ void test_iterator_tree__pathlist_with_directory(void)
i_opts
.
pathlist
.
strings
=
(
char
**
)
filelist
.
contents
;
i_opts
.
pathlist
.
strings
=
(
char
**
)
filelist
.
contents
;
i_opts
.
pathlist
.
count
=
filelist
.
length
;
i_opts
.
pathlist
.
count
=
filelist
.
length
;
i_opts
.
flags
|=
GIT_ITERATOR_DONT_IGNORE_CASE
;
cl_git_pass
(
git_iterator_for_tree
(
&
i
,
tree
,
&
i_opts
));
cl_git_pass
(
git_iterator_for_tree
(
&
i
,
tree
,
&
i_opts
));
expect_iterator_items
(
i
,
4
,
NULL
,
4
,
NULL
);
expect_iterator_items
(
i
,
expected_len
,
expected
,
expected_len
,
expected
);
git_iterator_free
(
i
);
git_iterator_free
(
i
);
git_vector_clear
(
&
filelist
);
git_vector_clear
(
&
filelist
);
...
@@ -999,7 +1007,7 @@ void test_iterator_tree__pathlist_with_directory(void)
...
@@ -999,7 +1007,7 @@ void test_iterator_tree__pathlist_with_directory(void)
i_opts
.
pathlist
.
count
=
filelist
.
length
;
i_opts
.
pathlist
.
count
=
filelist
.
length
;
cl_git_pass
(
git_iterator_for_tree
(
&
i
,
tree
,
&
i_opts
));
cl_git_pass
(
git_iterator_for_tree
(
&
i
,
tree
,
&
i_opts
));
expect_iterator_items
(
i
,
4
,
NULL
,
4
,
NULL
);
expect_iterator_items
(
i
,
expected_len
,
expected
,
expected_len
,
expected
);
git_iterator_free
(
i
);
git_iterator_free
(
i
);
git_vector_clear
(
&
filelist
);
git_vector_clear
(
&
filelist
);
...
@@ -1009,7 +1017,7 @@ void test_iterator_tree__pathlist_with_directory(void)
...
@@ -1009,7 +1017,7 @@ void test_iterator_tree__pathlist_with_directory(void)
i_opts
.
pathlist
.
count
=
filelist
.
length
;
i_opts
.
pathlist
.
count
=
filelist
.
length
;
cl_git_pass
(
git_iterator_for_tree
(
&
i
,
tree
,
&
i_opts
));
cl_git_pass
(
git_iterator_for_tree
(
&
i
,
tree
,
&
i_opts
));
expect_iterator_items
(
i
,
2
,
NULL
,
2
,
NULL
);
expect_iterator_items
(
i
,
expected_len2
,
expected2
,
expected_len2
,
expected2
);
git_iterator_free
(
i
);
git_iterator_free
(
i
);
git_vector_free
(
&
filelist
);
git_vector_free
(
&
filelist
);
...
@@ -1022,18 +1030,22 @@ void test_iterator_tree__pathlist_with_directory_include_tree_nodes(void)
...
@@ -1022,18 +1030,22 @@ void test_iterator_tree__pathlist_with_directory_include_tree_nodes(void)
git_vector
filelist
;
git_vector
filelist
;
git_tree
*
tree
;
git_tree
*
tree
;
const
char
*
expected
[]
=
{
"subdir/"
,
"subdir/README"
,
"subdir/new.txt"
,
"subdir/subdir2/"
,
"subdir/subdir2/README"
,
"subdir/subdir2/new.txt"
};
size_t
expected_len
=
6
;
g_repo
=
cl_git_sandbox_init
(
"testrepo2"
);
g_repo
=
cl_git_sandbox_init
(
"testrepo2"
);
git_repository_head_tree
(
&
tree
,
g_repo
);
git_repository_head_tree
(
&
tree
,
g_repo
);
cl_git_pass
(
git_vector_init
(
&
filelist
,
100
,
&
git__strcmp_cb
));
cl_git_pass
(
git_vector_init
(
&
filelist
,
100
,
&
git__strcmp_cb
));
cl_git_pass
(
git_vector_insert
(
&
filelist
,
"subdir"
));
cl_git_pass
(
git_vector_insert
(
&
filelist
,
"subdir"
));
i_opts
.
flags
|=
GIT_ITERATOR_INCLUDE_TREES
;
i_opts
.
pathlist
.
strings
=
(
char
**
)
filelist
.
contents
;
i_opts
.
pathlist
.
strings
=
(
char
**
)
filelist
.
contents
;
i_opts
.
pathlist
.
count
=
filelist
.
length
;
i_opts
.
pathlist
.
count
=
filelist
.
length
;
i_opts
.
flags
|=
GIT_ITERATOR_DONT_IGNORE_CASE
|
GIT_ITERATOR_INCLUDE_TREES
;
cl_git_pass
(
git_iterator_for_tree
(
&
i
,
tree
,
&
i_opts
));
cl_git_pass
(
git_iterator_for_tree
(
&
i
,
tree
,
&
i_opts
));
expect_iterator_items
(
i
,
6
,
NULL
,
6
,
NULL
);
expect_iterator_items
(
i
,
expected_len
,
expected
,
expected_len
,
expected
);
git_iterator_free
(
i
);
git_iterator_free
(
i
);
git_vector_free
(
&
filelist
);
git_vector_free
(
&
filelist
);
...
...
tests/iterator/workdir.c
View file @
8152a748
...
@@ -1410,6 +1410,10 @@ void test_iterator_workdir__pathlist_with_directory(void)
...
@@ -1410,6 +1410,10 @@ void test_iterator_workdir__pathlist_with_directory(void)
git_iterator_options
i_opts
=
GIT_ITERATOR_OPTIONS_INIT
;
git_iterator_options
i_opts
=
GIT_ITERATOR_OPTIONS_INIT
;
git_vector
filelist
;
git_vector
filelist
;
const
char
*
expected
[]
=
{
"subdir/README"
,
"subdir/new.txt"
,
"subdir/subdir2/README"
,
"subdir/subdir2/new.txt"
};
size_t
expected_len
=
4
;
cl_git_pass
(
git_vector_init
(
&
filelist
,
100
,
&
git__strcmp_cb
));
cl_git_pass
(
git_vector_init
(
&
filelist
,
100
,
&
git__strcmp_cb
));
cl_git_pass
(
git_vector_insert
(
&
filelist
,
"subdir/"
));
cl_git_pass
(
git_vector_insert
(
&
filelist
,
"subdir/"
));
...
@@ -1417,9 +1421,10 @@ void test_iterator_workdir__pathlist_with_directory(void)
...
@@ -1417,9 +1421,10 @@ void test_iterator_workdir__pathlist_with_directory(void)
i_opts
.
pathlist
.
strings
=
(
char
**
)
filelist
.
contents
;
i_opts
.
pathlist
.
strings
=
(
char
**
)
filelist
.
contents
;
i_opts
.
pathlist
.
count
=
filelist
.
length
;
i_opts
.
pathlist
.
count
=
filelist
.
length
;
i_opts
.
flags
|=
GIT_ITERATOR_DONT_IGNORE_CASE
;
cl_git_pass
(
git_iterator_for_workdir
(
&
i
,
g_repo
,
NULL
,
NULL
,
&
i_opts
));
cl_git_pass
(
git_iterator_for_workdir
(
&
i
,
g_repo
,
NULL
,
NULL
,
&
i_opts
));
expect_iterator_items
(
i
,
4
,
NULL
,
4
,
NULL
);
expect_iterator_items
(
i
,
expected_len
,
expected
,
expected_len
,
expected
);
git_iterator_free
(
i
);
git_iterator_free
(
i
);
git_vector_free
(
&
filelist
);
git_vector_free
(
&
filelist
);
...
...
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