Skip to content

Commit 77b1d9f

Browse files
sunshinecogitster
authored andcommitted
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 <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7abcbcb commit 77b1d9f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

t/t2102-update-index-symlinks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test_expect_success \
2525
'the index entry must still be a symbolic link' '
2626
case "$(git ls-files --stage --cached symlink)" in
2727
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;;
2929
esac'
3030

3131
test_done

t/t3402-rebase-merge.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ test_expect_success 'merge and rebase should match' '
6868
if test -s difference
6969
then
7070
cat difference
71-
(exit 1)
71+
false
7272
else
7373
echo happy
7474
fi
@@ -102,7 +102,7 @@ test_expect_success 'merge and rebase should match' '
102102
if test -s difference
103103
then
104104
cat difference
105-
(exit 1)
105+
false
106106
else
107107
echo happy
108108
fi
@@ -117,7 +117,7 @@ test_expect_success 'picking rebase' '
117117
echo happy
118118
else
119119
git show-branch
120-
(exit 1)
120+
false
121121
fi &&
122122
f=$(git diff-tree --name-only HEAD^ HEAD) &&
123123
g=$(git diff-tree --name-only HEAD^^ HEAD^) &&
@@ -127,7 +127,7 @@ test_expect_success 'picking rebase' '
127127
*)
128128
echo "$f"
129129
echo "$g"
130-
(exit 1)
130+
false
131131
esac
132132
'
133133

t/t3700-add.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ test_expect_success 'git add --refresh' '
177177
git read-tree HEAD &&
178178
case "$(git diff-index HEAD -- foo)" in
179179
:100644" "*"M foo") echo pass;;
180-
*) echo fail; (exit 1);;
180+
*) echo fail; false;;
181181
esac &&
182182
git add --refresh -- foo &&
183183
test -z "$(git diff-index HEAD -- foo)"

0 commit comments

Comments
 (0)