]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t7107: don't use test_must_fail()
authorDenton Liu <liu.denton@gmail.com>
Tue, 7 Jul 2020 06:04:36 +0000 (02:04 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Jul 2020 20:07:27 +0000 (13:07 -0700)
We had a `test_must_fail verify_expect`. However, the git command in
verify_expect() was not expected to fail; the test_cmp() was the failing
command. Be more precise about testing failure by accepting an optional
first argument of '!' which causes the result of the file comparison to
be negated.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7107-reset-pathspec-file.sh

index cad3a9de9efc21339d82b4532d5af482e3446bc9..15ccb14f7e26faa41ba07d7901e498a0f75f726d 100755 (executable)
@@ -22,7 +22,12 @@ restore_checkpoint () {
 
 verify_expect () {
        git status --porcelain -- fileA.t fileB.t fileC.t fileD.t >actual &&
-       test_cmp expect actual
+       if test "x$1" = 'x!'
+       then
+               ! test_cmp expect actual
+       else
+               test_cmp expect actual
+       fi
 }
 
 test_expect_success '--pathspec-from-file from stdin' '
@@ -131,7 +136,7 @@ test_expect_success 'quotes not compatible with --pathspec-file-nul' '
        cat >expect <<-\EOF &&
         D fileA.t
        EOF
-       test_must_fail verify_expect
+       verify_expect !
 '
 
 test_expect_success 'only touches what was listed' '