summaryrefslogtreecommitdiff
path: root/tests/checkout/crlf.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-06-09 03:50:00 +0000
committerEdward Thomson <ethomson@microsoft.com>2015-06-22 12:00:26 -0400
commit1e46d54584ea46f024f24a913200568b5694a7a7 (patch)
treee0971e20767617cb4907c78c7a08577551aeb84f /tests/checkout/crlf.c
parent8293c8f9a3ea18131af98b71fa9100dcba0ad438 (diff)
downloadlibgit2-1e46d54584ea46f024f24a913200568b5694a7a7.tar.gz
crlf tests: ensure that Unix obeys autocrlf=true
All platforms do terrible, horrible, no good, very bad translation when core.autocrlf=true. It's not just Windows!
Diffstat (limited to 'tests/checkout/crlf.c')
-rw-r--r--tests/checkout/crlf.c73
1 files changed, 17 insertions, 56 deletions
diff --git a/tests/checkout/crlf.c b/tests/checkout/crlf.c
index 8d45c1808..2cf3af364 100644
--- a/tests/checkout/crlf.c
+++ b/tests/checkout/crlf.c
@@ -220,11 +220,7 @@ void test_checkout_crlf__detect_crlf_autocrlf_true(void)
git_checkout_head(g_repo, &opts);
- if (GIT_EOL_NATIVE == GIT_EOL_LF)
- check_file_contents("./crlf/all-lf", ALL_LF_TEXT_RAW);
- else
- check_file_contents("./crlf/all-lf", ALL_LF_TEXT_AS_CRLF);
-
+ check_file_contents("./crlf/all-lf", ALL_LF_TEXT_AS_CRLF);
check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_RAW);
}
@@ -238,16 +234,8 @@ void test_checkout_crlf__detect_crlf_autocrlf_true_utf8(void)
git_repository_set_head(g_repo, "refs/heads/master");
git_checkout_head(g_repo, &opts);
- if (GIT_EOL_NATIVE == GIT_EOL_LF)
- {
- check_file_contents("./crlf/few-utf8-chars-lf", FEW_UTF8_LF_RAW);
- check_file_contents("./crlf/many-utf8-chars-lf", MANY_UTF8_LF_RAW);
- }
- else
- {
- check_file_contents("./crlf/few-utf8-chars-lf", FEW_UTF8_CRLF_RAW);
- check_file_contents("./crlf/many-utf8-chars-lf", MANY_UTF8_CRLF_RAW);
- }
+ check_file_contents("./crlf/few-utf8-chars-lf", FEW_UTF8_CRLF_RAW);
+ check_file_contents("./crlf/many-utf8-chars-lf", MANY_UTF8_CRLF_RAW);
check_file_contents("./crlf/few-utf8-chars-crlf", FEW_UTF8_CRLF_RAW);
check_file_contents("./crlf/many-utf8-chars-crlf", MANY_UTF8_CRLF_RAW);
@@ -269,10 +257,7 @@ void test_checkout_crlf__autocrlf_true_index_size_is_filtered_size(void)
cl_assert((entry = git_index_get_bypath(index, "all-lf", 0)) != NULL);
- if (GIT_EOL_NATIVE == GIT_EOL_LF)
- cl_assert_equal_sz(strlen(ALL_LF_TEXT_RAW), entry->file_size);
- else
- cl_assert_equal_sz(strlen(ALL_LF_TEXT_AS_CRLF), entry->file_size);
+ cl_assert_equal_sz(strlen(ALL_LF_TEXT_AS_CRLF), entry->file_size);
cl_assert((entry = git_index_get_bypath(index, "all-crlf", 0)) != NULL);
cl_assert_equal_sz(strlen(ALL_CRLF_TEXT_RAW), entry->file_size);
@@ -341,25 +326,14 @@ void test_checkout_crlf__with_ident(void)
git_checkout_head(g_repo, &opts);
- if (GIT_EOL_NATIVE == GIT_EOL_LF) {
- cl_assert_equal_file(
- ALL_LF_TEXT_RAW
- "\n$Id: fcf6d4d9c212dc66563b1171b1cd99953c756467 $\n",
- 0, "crlf/lf.ident");
- cl_assert_equal_file(
- ALL_CRLF_TEXT_AS_LF
- "\n$Id: f2c66ad9b2b5a734d9bf00d5000cc10a62b8a857 $\n\n",
- 0, "crlf/crlf.ident");
- } else {
- cl_assert_equal_file(
- ALL_LF_TEXT_AS_CRLF
- "\r\n$Id: fcf6d4d9c212dc66563b1171b1cd99953c756467 $\r\n",
- 0, "crlf/lf.ident");
- cl_assert_equal_file(
- ALL_CRLF_TEXT_RAW
- "\r\n$Id: f2c66ad9b2b5a734d9bf00d5000cc10a62b8a857 $\r\n\r\n",
- 0, "crlf/crlf.ident");
- }
+ cl_assert_equal_file(
+ ALL_LF_TEXT_AS_CRLF
+ "\r\n$Id: fcf6d4d9c212dc66563b1171b1cd99953c756467 $\r\n",
+ 0, "crlf/lf.ident");
+ cl_assert_equal_file(
+ ALL_CRLF_TEXT_RAW
+ "\r\n$Id: f2c66ad9b2b5a734d9bf00d5000cc10a62b8a857 $\r\n\r\n",
+ 0, "crlf/crlf.ident");
cl_assert_equal_file(
"$Id: f7830382dac1f1583422be5530fdfbd26289431b $\n"
@@ -394,13 +368,8 @@ void test_checkout_crlf__autocrlf_true_no_attrs(void)
git_checkout_head(g_repo, &opts);
- if (GIT_EOL_NATIVE == GIT_EOL_CRLF) {
- check_file_contents("./crlf/all-lf", ALL_LF_TEXT_AS_CRLF);
- check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_AS_CRLF);
- } else {
- check_file_contents("./crlf/all-lf", ALL_LF_TEXT_RAW);
- check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_RAW);
- }
+ check_file_contents("./crlf/all-lf", ALL_LF_TEXT_AS_CRLF);
+ check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_AS_CRLF);
}
void test_checkout_crlf__autocrlf_input_no_attrs(void)
@@ -447,13 +416,8 @@ void test_checkout_crlf__autocrlf_true_text_auto_attr(void)
git_checkout_head(g_repo, &opts);
- if (GIT_EOL_NATIVE == GIT_EOL_CRLF) {
- check_file_contents("./crlf/all-lf", ALL_LF_TEXT_AS_CRLF);
- check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_AS_CRLF);
- } else {
- check_file_contents("./crlf/all-lf", ALL_LF_TEXT_RAW);
- check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_RAW);
- }
+ check_file_contents("./crlf/all-lf", ALL_LF_TEXT_AS_CRLF);
+ check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_AS_CRLF);
}
void test_checkout_crlf__autocrlf_input_text_auto_attr(void)
@@ -483,10 +447,7 @@ void test_checkout_crlf__can_write_empty_file(void)
check_file_contents("./crlf/test1.txt", "");
- if (GIT_EOL_NATIVE == GIT_EOL_LF)
- check_file_contents("./crlf/test2.txt", "test2.txt's content\n");
- else
- check_file_contents("./crlf/test2.txt", "test2.txt's content\r\n");
+ check_file_contents("./crlf/test2.txt", "test2.txt's content\r\n");
check_file_contents("./crlf/test3.txt", "");
}