diff options
Diffstat (limited to 'tests-clar/checkout/tree.c')
-rw-r--r-- | tests-clar/checkout/tree.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/tests-clar/checkout/tree.c b/tests-clar/checkout/tree.c index 6d573bfd7..c6989598d 100644 --- a/tests-clar/checkout/tree.c +++ b/tests-clar/checkout/tree.c @@ -27,7 +27,7 @@ void test_checkout_tree__cannot_checkout_a_non_treeish(void) /* blob */ cl_git_pass(git_revparse_single(&g_object, g_repo, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd")); - cl_git_fail(git_checkout_tree(g_repo, g_object, NULL, NULL)); + cl_git_fail(git_checkout_tree(g_repo, g_object, NULL)); } void test_checkout_tree__can_checkout_a_subdirectory_from_a_commit(void) @@ -41,7 +41,7 @@ void test_checkout_tree__can_checkout_a_subdirectory_from_a_commit(void) cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/")); - cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts, NULL)); + cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts)); cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/2.txt")); cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/fgh/1.txt")); @@ -58,8 +58,26 @@ void test_checkout_tree__can_checkout_a_subdirectory_from_a_subtree(void) cl_assert_equal_i(false, git_path_isdir("./testrepo/de/")); - cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts, NULL)); + cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts)); cl_assert_equal_i(true, git_path_isfile("./testrepo/de/2.txt")); cl_assert_equal_i(true, git_path_isfile("./testrepo/de/fgh/1.txt")); } + +static void progress(const char *path, float progress, void *payload) +{ + GIT_UNUSED(path); GIT_UNUSED(progress); + int *count = (int*)payload; + (*count)++; +} + +void test_checkout_tree__calls_progress_callback(void) +{ + int count = 0; + g_opts.progress_cb = progress; + g_opts.progress_payload = &count; + + cl_git_pass(git_revparse_single(&g_object, g_repo, "master")); + cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts)); + cl_assert_equal_i(count, 4); +} |