Skip to content

Commit

Permalink
t9801: do not overuse test_must_fail
Browse files Browse the repository at this point in the history
test_must_fail is to make sure a program we can potentially break during
the course of updating git itself exits with a non-zero status in a clean
and controlled way.

When we expect a non-zero exit status from the commands we use from the
underlying platform in tests, e.g. making sure a string "error: " does not
appear in the output by running "grep 'error: '", just use "! grep" for
readability. It is not like we will try to update Git and suddenly 'grep'
we use from the system starts segfaulting.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Jan 26, 2012
1 parent 3558f32 commit e7d7a56
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions t/t9801-git-p4-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ test_expect_success 'git-p4 clone simple branches' '
test -f file1 &&
test -f file2 &&
test ! -f file3 &&
test_must_fail grep update file2 &&
! grep update file2 &&
git reset --hard p4/depot/branch3 &&
test -f file1 &&
test -f file2 &&
Expand Down Expand Up @@ -286,7 +286,7 @@ test_expect_success 'git-p4 clone complex branches' '
test_path_is_file file1 &&
test_path_is_file file2 &&
test_path_is_missing file3 &&
test_must_fail grep update file2 &&
! grep update file2 &&
git reset --hard p4/depot/branch3 &&
test_path_is_file file1 &&
test_path_is_file file2 &&
Expand All @@ -296,12 +296,12 @@ test_expect_success 'git-p4 clone complex branches' '
test_path_is_file file1 &&
test_path_is_file file2 &&
test_path_is_missing file3 &&
test_must_fail grep update file2 &&
! grep update file2 &&
git reset --hard p4/depot/branch5 &&
test_path_is_file file1 &&
test_path_is_file file2 &&
test_path_is_file file3 &&
test_must_fail grep update file2 &&
! grep update file2 &&
test_path_is_missing .git/git-p4-tmp
)
'
Expand Down

0 comments on commit e7d7a56

Please sign in to comment.