summaryrefslogtreecommitdiff
path: root/tests-clar/checkout/index.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-03-25 14:13:53 -0700
committerRussell Belfer <rb@github.com>2013-03-25 14:13:53 -0700
commit050ab9950d089c55e874b63e5ab9c8d0b948cf46 (patch)
treedadc0aecd4194c24fb00d7eda125561b277fe3a4 /tests-clar/checkout/index.c
parent4a15ea869ca097dca0b45b1202429cc12cb94219 (diff)
downloadlibgit2-050ab9950d089c55e874b63e5ab9c8d0b948cf46.tar.gz
Fix up checkout file contents checks
This fixes of the file contents checks in checkout to give slightly better error messages by directly calling the underlying clar assertions so the file and line number of the top level call can be reported correctly, and renames the helpers to not start with "test_" since that is kind of reserved by clar. This also enables some of the CRLF tests on all platforms that were previously Windows only (by pushing a check of the native line endings into the test body).
Diffstat (limited to 'tests-clar/checkout/index.c')
-rw-r--r--tests-clar/checkout/index.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/tests-clar/checkout/index.c b/tests-clar/checkout/index.c
index 33506a669..78ff5ac62 100644
--- a/tests-clar/checkout/index.c
+++ b/tests-clar/checkout/index.c
@@ -48,9 +48,9 @@ void test_checkout_index__can_create_missing_files(void)
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- test_file_contents("./testrepo/README", "hey there\n");
- test_file_contents("./testrepo/branch_file.txt", "hi\nbye!\n");
- test_file_contents("./testrepo/new.txt", "my new file\n");
+ check_file_contents("./testrepo/README", "hey there\n");
+ check_file_contents("./testrepo/branch_file.txt", "hi\nbye!\n");
+ check_file_contents("./testrepo/new.txt", "my new file\n");
}
void test_checkout_index__can_remove_untracked_files(void)
@@ -88,8 +88,8 @@ void test_checkout_index__honor_the_specified_pathspecs(void)
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
- test_file_contents("./testrepo/branch_file.txt", "hi\nbye!\n");
- test_file_contents("./testrepo/new.txt", "my new file\n");
+ check_file_contents("./testrepo/branch_file.txt", "hi\nbye!\n");
+ check_file_contents("./testrepo/new.txt", "my new file\n");
}
void test_checkout_index__honor_the_gitattributes_directives(void)
@@ -106,9 +106,9 @@ void test_checkout_index__honor_the_gitattributes_directives(void)
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- test_file_contents("./testrepo/README", "hey there\n");
- test_file_contents("./testrepo/new.txt", "my new file\n");
- test_file_contents("./testrepo/branch_file.txt", "hi\r\nbye!\r\n");
+ check_file_contents("./testrepo/README", "hey there\n");
+ check_file_contents("./testrepo/new.txt", "my new file\n");
+ check_file_contents("./testrepo/branch_file.txt", "hi\r\nbye!\r\n");
}
void test_checkout_index__honor_coreautocrlf_setting_set_to_true(void)
@@ -124,7 +124,7 @@ void test_checkout_index__honor_coreautocrlf_setting_set_to_true(void)
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- test_file_contents("./testrepo/README", expected_readme_text);
+ check_file_contents("./testrepo/README", expected_readme_text);
#endif
}
@@ -139,7 +139,7 @@ void test_checkout_index__honor_coresymlinks_setting_set_to_true(void)
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
#ifdef GIT_WIN32
- test_file_contents("./testrepo/link_to_new.txt", "new.txt");
+ check_file_contents("./testrepo/link_to_new.txt", "new.txt");
#else
{
char link_data[1024];
@@ -149,7 +149,7 @@ void test_checkout_index__honor_coresymlinks_setting_set_to_true(void)
link_data[link_size] = '\0';
cl_assert_equal_i(link_size, strlen("new.txt"));
cl_assert_equal_s(link_data, "new.txt");
- test_file_contents("./testrepo/link_to_new.txt", "my new file\n");
+ check_file_contents("./testrepo/link_to_new.txt", "my new file\n");
}
#endif
}
@@ -164,7 +164,7 @@ void test_checkout_index__honor_coresymlinks_setting_set_to_false(void)
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- test_file_contents("./testrepo/link_to_new.txt", "new.txt");
+ check_file_contents("./testrepo/link_to_new.txt", "new.txt");
}
void test_checkout_index__donot_overwrite_modified_file_by_default(void)
@@ -180,7 +180,7 @@ void test_checkout_index__donot_overwrite_modified_file_by_default(void)
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- test_file_contents("./testrepo/new.txt", "This isn't what's stored!");
+ check_file_contents("./testrepo/new.txt", "This isn't what's stored!");
}
void test_checkout_index__can_overwrite_modified_file(void)
@@ -193,7 +193,7 @@ void test_checkout_index__can_overwrite_modified_file(void)
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- test_file_contents("./testrepo/new.txt", "my new file\n");
+ check_file_contents("./testrepo/new.txt", "my new file\n");
}
void test_checkout_index__options_disable_filters(void)
@@ -207,14 +207,14 @@ void test_checkout_index__options_disable_filters(void)
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- test_file_contents("./testrepo/new.txt", "my new file\r\n");
+ check_file_contents("./testrepo/new.txt", "my new file\r\n");
p_unlink("./testrepo/new.txt");
opts.disable_filters = true;
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- test_file_contents("./testrepo/new.txt", "my new file\n");
+ check_file_contents("./testrepo/new.txt", "my new file\n");
}
void test_checkout_index__options_dir_modes(void)
@@ -274,7 +274,7 @@ void test_checkout_index__options_open_flags(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- test_file_contents("./testrepo/new.txt", "hi\nmy new file\n");
+ check_file_contents("./testrepo/new.txt", "hi\nmy new file\n");
}
struct notify_data {
@@ -469,9 +469,9 @@ void test_checkout_index__can_update_prefixed_files(void)
/* remove untracked will remove the .gitattributes file before the blobs
* were created, so they will have had crlf filtering applied on Windows
*/
- test_file_contents_nocr("./testrepo/README", "hey there\n");
- test_file_contents_nocr("./testrepo/branch_file.txt", "hi\nbye!\n");
- test_file_contents_nocr("./testrepo/new.txt", "my new file\n");
+ check_file_contents_nocr("./testrepo/README", "hey there\n");
+ check_file_contents_nocr("./testrepo/branch_file.txt", "hi\nbye!\n");
+ check_file_contents_nocr("./testrepo/new.txt", "my new file\n");
cl_assert(!git_path_exists("testrepo/READ"));
cl_assert(!git_path_exists("testrepo/README.after"));
@@ -503,5 +503,5 @@ void test_checkout_index__issue_1397(void)
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- test_file_contents("./issue_1397/crlf_file.txt", "first line\r\nsecond line\r\nboth with crlf");
+ check_file_contents("./issue_1397/crlf_file.txt", "first line\r\nsecond line\r\nboth with crlf");
}