Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f3f4c6b

Browse files
committed
Fix checkout tests on Windows
1 parent 353a90b commit f3f4c6b

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

tests-clar/checkout/index.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ void test_checkout_index__initialize(void)
2626
void test_checkout_index__cleanup(void)
2727
{
2828
cl_git_sandbox_cleanup();
29+
30+
/* try to remove alternative dir */
31+
if (git_path_isdir("alternative"))
32+
git_futils_rmdir_r("alternative", NULL, GIT_RMDIR_REMOVE_FILES);
2933
}
3034

3135
void test_checkout_index__cannot_checkout_a_bare_repository(void)
@@ -576,9 +580,10 @@ void test_checkout_index__target_directory_from_bare(void)
576580
cl_assert_equal_i(0, cts.n_ignored);
577581
cl_assert_equal_i(3, cts.n_updates);
578582

579-
check_file_contents("./alternative/README", "hey there\n");
580-
check_file_contents("./alternative/branch_file.txt", "hi\nbye!\n");
581-
check_file_contents("./alternative/new.txt", "my new file\n");
583+
/* files will have been filtered if needed, so strip CR */
584+
check_file_contents_nocr("./alternative/README", "hey there\n");
585+
check_file_contents_nocr("./alternative/branch_file.txt", "hi\nbye!\n");
586+
check_file_contents_nocr("./alternative/new.txt", "my new file\n");
582587

583588
cl_git_pass(git_futils_rmdir_r(
584589
"alternative", NULL, GIT_RMDIR_REMOVE_FILES));

tests-clar/checkout/tree.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ void test_checkout_tree__cleanup(void)
2424
g_object = NULL;
2525

2626
cl_git_sandbox_cleanup();
27+
28+
if (git_path_isdir("alternative"))
29+
git_futils_rmdir_r("alternative", NULL, GIT_RMDIR_REMOVE_FILES);
2730
}
2831

2932
void test_checkout_tree__cannot_checkout_a_non_treeish(void)
@@ -667,9 +670,9 @@ void test_checkout_tree__target_directory_from_bare(void)
667670
cl_assert_equal_i(0, cts.n_ignored);
668671
cl_assert_equal_i(3, cts.n_updates);
669672

670-
check_file_contents("./alternative/README", "hey there\n");
671-
check_file_contents("./alternative/branch_file.txt", "hi\nbye!\n");
672-
check_file_contents("./alternative/new.txt", "my new file\n");
673+
check_file_contents_nocr("./alternative/README", "hey there\n");
674+
check_file_contents_nocr("./alternative/branch_file.txt", "hi\nbye!\n");
675+
check_file_contents_nocr("./alternative/new.txt", "my new file\n");
673676

674677
cl_git_pass(git_futils_rmdir_r(
675678
"alternative", NULL, GIT_RMDIR_REMOVE_FILES));

0 commit comments

Comments
 (0)