[PATCHv3 02/16] t4017 (diff-retval): replace manual exit code check with test_expect_code

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

 



Signed-off-by: Elijah Newren <newren@xxxxxxxxx>
---
 t/t4017-diff-retval.sh |   30 ++++++++++--------------------
 1 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh
index 6158985..6605e12 100755
--- a/t/t4017-diff-retval.sh
+++ b/t/t4017-diff-retval.sh
@@ -28,37 +28,29 @@ test_expect_success 'git diff --quiet -w  HEAD^ HEAD' '
 	test_must_fail git diff --quiet -w HEAD^ HEAD
 '
 
-test_expect_success 'git diff-tree HEAD^ HEAD' '
+test_expect_code 1 'git diff-tree HEAD^ HEAD' '
 	git diff-tree --exit-code HEAD^ HEAD
-	test $? = 1
 '
-test_expect_success 'git diff-tree HEAD^ HEAD -- a' '
+test_expect_code 0 'git diff-tree HEAD^ HEAD -- a' '
 	git diff-tree --exit-code HEAD^ HEAD -- a
-	test $? = 0
 '
-test_expect_success 'git diff-tree HEAD^ HEAD -- b' '
+test_expect_code 1 'git diff-tree HEAD^ HEAD -- b' '
 	git diff-tree --exit-code HEAD^ HEAD -- b
-	test $? = 1
 '
-test_expect_success 'echo HEAD | git diff-tree --stdin' '
+test_expect_code 1 'echo HEAD | git diff-tree --stdin' '
 	echo $(git rev-parse HEAD) | git diff-tree --exit-code --stdin
-	test $? = 1
 '
-test_expect_success 'git diff-tree HEAD HEAD' '
+test_expect_code 0 'git diff-tree HEAD HEAD' '
 	git diff-tree --exit-code HEAD HEAD
-	test $? = 0
 '
-test_expect_success 'git diff-files' '
+test_expect_code 0 'git diff-files' '
 	git diff-files --exit-code
-	test $? = 0
 '
-test_expect_success 'git diff-index --cached HEAD' '
+test_expect_code 0 'git diff-index --cached HEAD' '
 	git diff-index --exit-code --cached HEAD
-	test $? = 0
 '
-test_expect_success 'git diff-index --cached HEAD^' '
+test_expect_code 1 'git diff-index --cached HEAD^' '
 	git diff-index --exit-code --cached HEAD^
-	test $? = 1
 '
 test_expect_success 'git diff-index --cached HEAD^' '
 	echo text >>b &&
@@ -74,9 +66,8 @@ test_expect_success 'git diff-tree -Stext HEAD^ HEAD -- b' '
 		test $? = 1
 	}
 '
-test_expect_success 'git diff-tree -Snot-found HEAD^ HEAD -- b' '
+test_expect_code 0 'git diff-tree -Snot-found HEAD^ HEAD -- b' '
 	git diff-tree -p --exit-code -Snot-found HEAD^ HEAD -- b
-	test $? = 0
 '
 test_expect_success 'git diff-files' '
 	echo 3 >>c && {
@@ -113,10 +104,9 @@ test_expect_success '--check --exit-code returns 3 for a dirty difference' '
 
 '
 
-test_expect_success '--check with --no-pager returns 2 for dirty difference' '
+test_expect_code 2 '--check with --no-pager returns 2 for dirty difference' '
 
 	git --no-pager diff --check
-	test $? = 2
 
 '
 
-- 
1.7.3.95.g14291

--
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]