diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2015-09-08 11:50:08 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-09-08 11:50:08 -0400 |
| commit | 2964cbeae14f52a42f82b5bf6fbb22cfcb5bd4c9 (patch) | |
| tree | 0544ede140e628e85691d3a8a6886cb97c38cddc /tests/index | |
| parent | e1d27bcaafaadf4ef5eeae19c96835c6663c4289 (diff) | |
| parent | c097f7173daced0f86fd816a72ad5fc0f636484a (diff) | |
| download | libgit2-2964cbeae14f52a42f82b5bf6fbb22cfcb5bd4c9.tar.gz | |
Merge pull request #3381 from leoyanggit/index_directory_iterator
New feature: add the ablility to iterate through a directory in index
Diffstat (limited to 'tests/index')
| -rw-r--r-- | tests/index/tests.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/index/tests.c b/tests/index/tests.c index f1a057853..2a416fc7b 100644 --- a/tests/index/tests.c +++ b/tests/index/tests.c @@ -155,6 +155,27 @@ void test_index_tests__find_in_empty(void) git_index_free(index); } +void test_index_tests__find_prefix(void) +{ + git_index *index; + const git_index_entry *entry; + size_t pos; + + cl_git_pass(git_index_open(&index, TEST_INDEX_PATH)); + + cl_git_pass(git_index_find_prefix(&pos, index, "src")); + entry = git_index_get_byindex(index, pos); + cl_assert(git__strcmp(entry->path, "src/block-sha1/sha1.c") == 0); + + cl_git_pass(git_index_find_prefix(&pos, index, "src/co")); + entry = git_index_get_byindex(index, pos); + cl_assert(git__strcmp(entry->path, "src/commit.c") == 0); + + cl_assert(GIT_ENOTFOUND == git_index_find_prefix(NULL, index, "blah")); + + git_index_free(index); +} + void test_index_tests__write(void) { git_index *index; |
