Skip to content

Commit e7d7a56

Browse files
committed
t9801: do not overuse test_must_fail
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 <[email protected]>
1 parent 3558f32 commit e7d7a56

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

t/t9801-git-p4-branch.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ test_expect_success 'git-p4 clone simple branches' '
208208
test -f file1 &&
209209
test -f file2 &&
210210
test ! -f file3 &&
211-
test_must_fail grep update file2 &&
211+
! grep update file2 &&
212212
git reset --hard p4/depot/branch3 &&
213213
test -f file1 &&
214214
test -f file2 &&
@@ -286,7 +286,7 @@ test_expect_success 'git-p4 clone complex branches' '
286286
test_path_is_file file1 &&
287287
test_path_is_file file2 &&
288288
test_path_is_missing file3 &&
289-
test_must_fail grep update file2 &&
289+
! grep update file2 &&
290290
git reset --hard p4/depot/branch3 &&
291291
test_path_is_file file1 &&
292292
test_path_is_file file2 &&
@@ -296,12 +296,12 @@ test_expect_success 'git-p4 clone complex branches' '
296296
test_path_is_file file1 &&
297297
test_path_is_file file2 &&
298298
test_path_is_missing file3 &&
299-
test_must_fail grep update file2 &&
299+
! grep update file2 &&
300300
git reset --hard p4/depot/branch5 &&
301301
test_path_is_file file1 &&
302302
test_path_is_file file2 &&
303303
test_path_is_file file3 &&
304-
test_must_fail grep update file2 &&
304+
! grep update file2 &&
305305
test_path_is_missing .git/git-p4-tmp
306306
)
307307
'

0 commit comments

Comments
 (0)