Skip to content

Commit 16b2672

Browse files
drafnelgitster
authored andcommitted
t4018-diff-funcname: rework negated last expression test
This test used the non-zero exit status of 'git diff' to indicate that a negated funcname pattern, when placed last, was correctly rejected. The problem with this is that 'git diff' always returns non-zero if it finds differences in the files it is comparing, and the files must contain differences in order to trigger the funcname pattern codepath. Instead of checking for non-zero exit status, make sure the expected error message is printed. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6c2a602 commit 16b2672

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

t/t4018-diff-funcname.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ test_expect_success 'custom pattern' '
6565

6666
test_expect_success 'last regexp must not be negated' '
6767
git config diff.java.funcname "!static" &&
68-
test_must_fail git diff --no-index Beer.java Beer-correct.java
68+
git diff --no-index Beer.java Beer-correct.java 2>&1 |
69+
grep "fatal: Last expression must not be negated:"
6970
'
7071

7172
test_expect_success 'alternation in pattern' '

0 commit comments

Comments
 (0)