diff options
author | Marc Strapetz <marc.strapetz@gmail.com> | 2016-03-22 10:28:50 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-03-24 15:59:49 -0400 |
commit | 09064f15c5c4efc0f4d9f4312e0aa4a11661ce4f (patch) | |
tree | 378316c7d02db10a3f90b852fa4ee0b60dca05c9 | |
parent | 8152a748211f7a9c1a4ee8d28746ca20deb8928e (diff) | |
download | libgit2-09064f15c5c4efc0f4d9f4312e0aa4a11661ce4f.tar.gz |
iterator: new index-iterator test for pathlist + includings trees
-rw-r--r-- | tests/iterator/index.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/iterator/index.c b/tests/iterator/index.c index a48e07b4c..64e7b14ba 100644 --- a/tests/iterator/index.c +++ b/tests/iterator/index.c @@ -731,6 +731,37 @@ void test_iterator_index__pathlist_with_dirs(void) git_vector_free(&filelist); } +void test_iterator_index__pathlist_with_dirs_include_trees(void) +{ + git_iterator *i; + git_iterator_options i_opts = GIT_ITERATOR_OPTIONS_INIT; + git_index *index; + git_vector filelist; + + const char *expected[] = { "k/", "k/1", "k/B", "k/D", "k/a", "k/c" }; + size_t expected_len = 6; + + cl_git_pass(git_vector_init(&filelist, 5, NULL)); + + g_repo = cl_git_sandbox_init("icase"); + + cl_git_pass(git_repository_index(&index, g_repo)); + + git_vector_clear(&filelist); + cl_git_pass(git_vector_insert(&filelist, "k")); + + i_opts.pathlist.strings = (char **)filelist.contents; + i_opts.pathlist.count = filelist.length; + i_opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE | GIT_ITERATOR_INCLUDE_TREES; + + cl_git_pass(git_iterator_for_index(&i, g_repo, index, &i_opts)); + expect_iterator_items(i, expected_len, expected, expected_len, expected); + git_iterator_free(i); + + git_index_free(index); + git_vector_free(&filelist); +} + void test_iterator_index__pathlist_1(void) { git_iterator *i; |