diff options
Diffstat (limited to 'tests-clar/refs/foreachglob.c')
| -rw-r--r-- | tests-clar/refs/foreachglob.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests-clar/refs/foreachglob.c b/tests-clar/refs/foreachglob.c index b024d36d4..66827e525 100644 --- a/tests-clar/refs/foreachglob.c +++ b/tests-clar/refs/foreachglob.c @@ -68,3 +68,25 @@ void test_refs_foreachglob__retrieve_partially_named_references(void) assert_retrieval("*test*", GIT_REF_LISTALL, 4); } + + +static int interrupt_cb(const char *reference_name, void *payload) +{ + int *count = (int *)payload; + + GIT_UNUSED(reference_name); + + (*count)++; + + return (*count == 11); +} + +void test_refs_foreachglob__can_cancel(void) +{ + int count = 0; + + cl_assert_equal_i(GIT_EUSER, git_reference_foreach_glob( + repo, "*", GIT_REF_LISTALL, interrupt_cb, &count) ); + + cl_assert_equal_i(11, count); +} |
