[PATCH 01/12] t6038 (merge.renormalize): style nitpicks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some tweaks to simplify adding and running tests.

 - Use test_tick for predictable, sort of realistic commit dates;

 - Use test_cmp as "test_cmp expected actual" --- some crazy
   content that was not expected should cause the test to fail;

 - Remove and re-add all files at the start of each test so the
   worktree is easier to think about;

 - Avoid using cat where not necessary for clarity.

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 t/t6038-merge-text-auto.sh |   52 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/t/t6038-merge-text-auto.sh b/t/t6038-merge-text-auto.sh
index d1ab86e..e21b5d2 100755
--- a/t/t6038-merge-text-auto.sh
+++ b/t/t6038-merge-text-auto.sh
@@ -1,58 +1,94 @@
 #!/bin/sh
 
-test_description='CRLF merge conflict across text=auto change'
+test_description='CRLF merge conflict across text=auto change
+
+* [master] remove .gitattributes
+ ! [side] add line from b
+--
+ + [side] add line from b
+*  [master] remove .gitattributes
+*  [master^] add line from a
+*  [master~2] normalize file
+*+ [side^] Initial
+'
 
 . ./test-lib.sh
 
 test_expect_success setup '
 	git config merge.renormalize true &&
 	git config core.autocrlf false &&
+
 	echo first line | append_cr >file &&
 	echo first line >control_file &&
 	echo only line >inert_file &&
+
 	git add file control_file inert_file &&
+	test_tick &&
 	git commit -m "Initial" &&
 	git tag initial &&
 	git branch side &&
+
 	echo "* text=auto" >.gitattributes &&
 	touch file &&
 	git add .gitattributes file &&
+	test_tick &&
 	git commit -m "normalize file" &&
+
 	echo same line | append_cr >>file &&
 	echo same line >>control_file &&
 	git add file control_file &&
+	test_tick &&
 	git commit -m "add line from a" &&
 	git tag a &&
+
 	git rm .gitattributes &&
 	rm file &&
 	git checkout file &&
+	test_tick &&
 	git commit -m "remove .gitattributes" &&
 	git tag c &&
+
 	git checkout side &&
 	echo same line | append_cr >>file &&
 	echo same line >>control_file &&
 	git add file control_file &&
+	test_tick &&
 	git commit -m "add line from b" &&
 	git tag b &&
+
 	git checkout master
 '
 
-test_expect_success 'Check merging after setting text=auto' '
+test_expect_success 'Merge after setting text=auto' '
+	cat <<-\EOF >expected &&
+	first line
+	same line
+	EOF
+
+	git rm -fr . &&
+	rm -f .gitattributes &&
 	git reset --hard a &&
 	git merge b &&
-	cat file | remove_cr >file.temp &&
-	test_cmp file file.temp
+	test_cmp expected file
 '
 
-test_expect_success 'Check merging addition of text=auto' '
+test_expect_success 'Merge addition of text=auto' '
+	cat <<-\EOF >expected &&
+	first line
+	same line
+	EOF
+
+	git rm -fr . &&
+	rm -f .gitattributes &&
 	git reset --hard b &&
 	git merge a &&
-	cat file | remove_cr >file.temp &&
-	test_cmp file file.temp
+	test_cmp expected file
 '
 
 test_expect_success 'Test delete/normalize conflict' '
-	git checkout side &&
+	git checkout -f side &&
+	git rm -fr . &&
+	rm -f .gitattributes &&
 	git reset --hard initial &&
 	git rm file &&
 	git commit -m "remove file" &&
-- 
1.7.2.1.544.ga752d.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]