git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 2/3] MinGW: Update tests to handle a native eol of crlf
@ 2014-08-22 19:19 Torsten Bögershausen
  0 siblings, 0 replies; only message in thread
From: Torsten Bögershausen @ 2014-08-22 19:19 UTC (permalink / raw)
  To: git; +Cc: tboegi

Some of the tests were written with the assumption that the native eol would
always be lf. After defining NATIVE_CRLF on MinGW, these tests began failing.
This change will update the tests to also handle a native eol of crlf.

Signed-off-by: Brice Lambson <bricelam@live.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 t/t6038-merge-text-auto.sh | 54 +++++++++++++++++++++++++++++-----------------
 t/test-lib.sh              |  1 +
 2 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/t/t6038-merge-text-auto.sh b/t/t6038-merge-text-auto.sh
index d9c2d38..85c10b0 100755
--- a/t/t6038-merge-text-auto.sh
+++ b/t/t6038-merge-text-auto.sh
@@ -72,6 +72,10 @@ test_expect_success 'Merge after setting text=auto' '
 	same line
 	EOF
 
+	if test_have_prereq NATIVE_CRLF; then
+		append_cr <expected >expected.temp &&
+		mv expected.temp expected
+	fi &&
 	git config merge.renormalize true &&
 	git rm -fr . &&
 	rm -f .gitattributes &&
@@ -86,6 +90,10 @@ test_expect_success 'Merge addition of text=auto' '
 	same line
 	EOF
 
+	if test_have_prereq NATIVE_CRLF; then
+		append_cr <expected >expected.temp &&
+		mv expected.temp expected
+	fi &&
 	git config merge.renormalize true &&
 	git rm -fr . &&
 	rm -f .gitattributes &&
@@ -95,16 +103,19 @@ test_expect_success 'Merge addition of text=auto' '
 '
 
 test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
-	q_to_cr <<-\EOF >expected &&
-	<<<<<<<
-	first line
-	same line
-	=======
-	first lineQ
-	same lineQ
-	>>>>>>>
-	EOF
-
+	echo "<<<<<<<" >expected &&
+	if test_have_prereq NATIVE_CRLF; then
+		echo first line | append_cr >>expected &&
+		echo same line | append_cr >>expected &&
+		echo ======= | append_cr >>expected
+	else
+		echo first line >>expected &&
+		echo same line >>expected &&
+		echo ======= >>expected
+	fi &&
+	echo first line | append_cr >>expected &&
+	echo same line | append_cr >>expected &&
+	echo ">>>>>>>" >>expected &&
 	git config merge.renormalize false &&
 	rm -f .gitattributes &&
 	git reset --hard a &&
@@ -114,16 +125,19 @@ test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
 '
 
 test_expect_success 'Detect LF/CRLF conflict from addition of text=auto' '
-	q_to_cr <<-\EOF >expected &&
-	<<<<<<<
-	first lineQ
-	same lineQ
-	=======
-	first line
-	same line
-	>>>>>>>
-	EOF
-
+	echo "<<<<<<<" >expected &&
+	echo first line | append_cr >>expected &&
+	echo same line | append_cr >>expected &&
+	if test_have_prereq NATIVE_CRLF; then
+		echo ======= | append_cr >>expected &&
+		echo first line | append_cr >>expected &&
+		echo same line | append_cr >>expected
+	else
+		echo ======= >>expected &&
+		echo first line >>expected &&
+		echo same line >>expected
+	fi &&
+	echo ">>>>>>>" >>expected &&
 	git config merge.renormalize false &&
 	rm -f .gitattributes &&
 	git reset --hard b &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index b1bc65b..aceb418 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -871,6 +871,7 @@ case $(uname -s) in
 	# exec does not inherit the PID
 	test_set_prereq MINGW
 	test_set_prereq NOT_CYGWIN
+	test_set_prereq NATIVE_CRLF
 	test_set_prereq SED_STRIPS_CR
 	test_set_prereq GREP_STRIPS_CR
 	GIT_TEST_CMP=mingw_test_cmp
-- 
2.1.0.rc2.210.g636bceb

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-08-22 19:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-22 19:19 [PATCH v2 2/3] MinGW: Update tests to handle a native eol of crlf Torsten Bögershausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).