]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: apply modern idiom for signaling test failure
authorEric Sunshine <sunshine@sunshineco.com>
Thu, 9 Dec 2021 05:11:09 +0000 (00:11 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Dec 2021 18:29:48 +0000 (10:29 -0800)
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>
t/t2102-update-index-symlinks.sh
t/t3402-rebase-merge.sh
t/t3700-add.sh

index 22f2c730ae8dbf995605e9134eeb2a5bc84065db..9b11130ab93a327f9c5e57cbe37062e3e095dbee 100755 (executable)
@@ -25,7 +25,7 @@ test_expect_success \
 'the index entry must still be a symbolic link' '
 case "$(git ls-files --stage --cached symlink)" in
 120000" "*symlink) echo pass;;
-*) echo fail; git ls-files --stage --cached symlink; (exit 1);;
+*) echo fail; git ls-files --stage --cached symlink; false;;
 esac'
 
 test_done
index cfde68f1939baeba49dc1b0d34d2c666042f9177..7e46f4ca850616b695cc6ffa061ca39ac404fb7d 100755 (executable)
@@ -68,7 +68,7 @@ test_expect_success 'merge and rebase should match' '
        if test -s difference
        then
                cat difference
-               (exit 1)
+               false
        else
                echo happy
        fi
@@ -102,7 +102,7 @@ test_expect_success 'merge and rebase should match' '
        if test -s difference
        then
                cat difference
-               (exit 1)
+               false
        else
                echo happy
        fi
@@ -117,7 +117,7 @@ test_expect_success 'picking rebase' '
                echo happy
        else
                git show-branch
-               (exit 1)
+               false
        fi &&
        f=$(git diff-tree --name-only HEAD^ HEAD) &&
        g=$(git diff-tree --name-only HEAD^^ HEAD^) &&
@@ -127,7 +127,7 @@ test_expect_success 'picking rebase' '
        *)
                echo "$f"
                echo "$g"
-               (exit 1)
+               false
        esac
 '
 
index 23c3c214c579f7edc8c8d47452921f0daee436db..6902807ff8790c14e47477fb603e50d195cf79c4 100755 (executable)
@@ -177,7 +177,7 @@ test_expect_success 'git add --refresh' '
        git read-tree HEAD &&
        case "$(git diff-index HEAD -- foo)" in
        :100644" "*"M   foo") echo pass;;
-       *) echo fail; (exit 1);;
+       *) echo fail; false;;
        esac &&
        git add --refresh -- foo &&
        test -z "$(git diff-index HEAD -- foo)"