]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t4013: support test_expect_failure through ':failure' magic
authorSergey Organov <sorganov@gmail.com>
Mon, 21 Dec 2020 15:19:43 +0000 (18:19 +0300)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Dec 2020 21:47:31 +0000 (13:47 -0800)
Add support to be able to specify expected failure, through :failure
magic, like this:

:failure cmd args

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4013-diff-various.sh

index 5c7b0122b4f194d327d488d4b5dd6b8ad28e7673..935d10ac057231b957abb2fba32fbd523512b852 100755 (executable)
@@ -174,6 +174,7 @@ process_diffs () {
 V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g')
 while read magic cmd
 do
+       status=success
        case "$magic" in
        '' | '#'*)
                continue ;;
@@ -182,6 +183,10 @@ do
                label="$magic-$cmd"
                case "$magic" in
                noellipses) ;;
+               failure)
+                       status=failure
+                       magic=
+                       label="$cmd" ;;
                *)
                        BUG "unknown magic $magic" ;;
                esac ;;
@@ -194,7 +199,7 @@ do
        expect="$TEST_DIRECTORY/t4013/diff.$test"
        actual="$pfx-diff.$test"
 
-       test_expect_success "git $cmd # magic is ${magic:-(not used)}" '
+       test_expect_$status "git $cmd # magic is ${magic:-(not used)}" '
                {
                        echo "$ git $cmd"
                        case "$magic" in