t4013: support test_expect_failure through ':failure' magic

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>

Sergey Organov committed Dec 21, 2020 at 18:19 UTC 14c14b44e47bc8c420e5161abc8fe283121f3e31
1 file changed +6 -1
t/t4013-diff-various.sh
+6 -1
@@ -174,6 +174,7 @@ process_diffs () {
174 V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g')
175 while read magic cmd
176 do
177 + status=success
178 case "$magic" in
179 '' | '#'*)
180 continue ;;
@@ -182,6 +183,10 @@ do
183 label="$magic-$cmd"
184 case "$magic" in
185 noellipses) ;;
186 + failure)
187 + status=failure
188 + magic=
189 + label="$cmd" ;;
190 *)
191 BUG "unknown magic $magic" ;;
192 esac ;;
@@ -194,7 +199,7 @@ do
199 expect="$TEST_DIRECTORY/t4013/diff.$test"
200 actual="$pfx-diff.$test"
201
197 - test_expect_success "git $cmd # magic is ${magic:-(not used)}" '
202 + test_expect_$status "git $cmd # magic is ${magic:-(not used)}" '
203 {
204 echo "$ git $cmd"
205 case "$magic" in