tests: apply modern idiom for signaling test failure

Simplify the way these tests signal failure by employing the modern idiom of making the `if` or `case` statement resolve to false when an error is detected. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Eric Sunshine committed Dec 9, 2021 at 00:11 UTC 77b1d9f355b44b68b4bb08a8143d13330fe4c562
3 files changed +6 -6
t/t2102-update-index-symlinks.sh
+1 -1
@@ -25,7 +25,7 @@ test_expect_success \
25 'the index entry must still be a symbolic link' '
26 case "$(git ls-files --stage --cached symlink)" in
27 120000" "*symlink) echo pass;;
28 -*) echo fail; git ls-files --stage --cached symlink; (exit 1);;
28 +*) echo fail; git ls-files --stage --cached symlink; false;;
29 esac'
30
31 test_done
t/t3402-rebase-merge.sh
+4 -4
@@ -68,7 +68,7 @@ test_expect_success 'merge and rebase should match' '
68 if test -s difference
69 then
70 cat difference
71 - (exit 1)
71 + false
72 else
73 echo happy
74 fi
@@ -102,7 +102,7 @@ test_expect_success 'merge and rebase should match' '
102 if test -s difference
103 then
104 cat difference
105 - (exit 1)
105 + false
106 else
107 echo happy
108 fi
@@ -117,7 +117,7 @@ test_expect_success 'picking rebase' '
117 echo happy
118 else
119 git show-branch
120 - (exit 1)
120 + false
121 fi &&
122 f=$(git diff-tree --name-only HEAD^ HEAD) &&
123 g=$(git diff-tree --name-only HEAD^^ HEAD^) &&
@@ -127,7 +127,7 @@ test_expect_success 'picking rebase' '
127 *)
128 echo "$f"
129 echo "$g"
130 - (exit 1)
130 + false
131 esac
132 '
133
t/t3700-add.sh
+1 -1
@@ -177,7 +177,7 @@ test_expect_success 'git add --refresh' '
177 git read-tree HEAD &&
178 case "$(git diff-index HEAD -- foo)" in
179 :100644" "*"M foo") echo pass;;
180 - *) echo fail; (exit 1);;
180 + *) echo fail; false;;
181 esac &&
182 git add --refresh -- foo &&
183 test -z "$(git diff-index HEAD -- foo)"