Skip to content

Commit

Permalink
t4018-diff-funcname: rework negated last expression test
Browse files Browse the repository at this point in the history
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 <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Brandon Casey authored and Junio C Hamano committed Oct 16, 2008
1 parent 6c2a602 commit 16b2672
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion t/t4018-diff-funcname.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ test_expect_success 'custom pattern' '

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

test_expect_success 'alternation in pattern' '
Expand Down

0 comments on commit 16b2672

Please sign in to comment.