]> git.ipfire.org Git - thirdparty/git.git/commitdiff
merge tests: use "test_must_fail" instead of ad-hoc pattern
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Mon, 7 Mar 2022 12:48:58 +0000 (13:48 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Mar 2022 21:27:40 +0000 (13:27 -0800)
As in the preceding commit change a similar fragile test pattern
introduced in b798671fa93 (merge-recursive: do not rudely die on
binary merge, 2007-08-14) to use a "test_must_fail" instead.

Before this we wouldn't distinguish normal "git merge" failures from
segfaults or abort(). Unlike the preceding commit we didn't end up
hiding any SANITIZE=leak failures in this case, but let's
correspondingly change these anyway.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6407-merge-binary.sh

index 8e6241f92e6a6c10b8686900bf1ed61c2c96d4d3..0753fc95f45efb642543f9f23191d3430d4d6cde 100755 (executable)
@@ -43,14 +43,9 @@ test_expect_success resolve '
        rm -f a* m* &&
        git reset --hard anchor &&
 
-       if git merge -s resolve main
-       then
-               echo Oops, should not have succeeded
-               false
-       else
-               git ls-files -s >current &&
-               test_cmp expect current
-       fi
+       test_must_fail git merge -s resolve main &&
+       git ls-files -s >current &&
+       test_cmp expect current
 '
 
 test_expect_success recursive '
@@ -58,14 +53,9 @@ test_expect_success recursive '
        rm -f a* m* &&
        git reset --hard anchor &&
 
-       if git merge -s recursive main
-       then
-               echo Oops, should not have succeeded
-               false
-       else
-               git ls-files -s >current &&
-               test_cmp expect current
-       fi
+       test_must_fail git merge -s recursive main &&
+       git ls-files -s >current &&
+       test_cmp expect current
 '
 
 test_done