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 <gitster@pobox.com>
Junio C Hamano committed
Jan 26, 2012 at 11:40 UTC
e7d7a56796c457b0a96e58e7638950db824b52af
1 file changed
+4
-4
t/t9801-git-p4-branch.sh
+4
-4
@@ -208,7 +208,7 @@ test_expect_success 'git-p4 clone simple branches' '
208
test -f file1 &&
209
test -f file2 &&
210
test ! -f file3 &&
211
- test_must_fail grep update file2 &&
211
+ ! grep update file2 &&
212
git reset --hard p4/depot/branch3 &&
213
test -f file1 &&
214
test -f file2 &&
@@ -286,7 +286,7 @@ test_expect_success 'git-p4 clone complex branches' '
286
test_path_is_file file1 &&
287
test_path_is_file file2 &&
288
test_path_is_missing file3 &&
289
- test_must_fail grep update file2 &&
289
+ ! grep update file2 &&
290
git reset --hard p4/depot/branch3 &&
291
test_path_is_file file1 &&
292
test_path_is_file file2 &&
@@ -296,12 +296,12 @@ test_expect_success 'git-p4 clone complex branches' '
296
test_path_is_file file1 &&
297
test_path_is_file file2 &&
298
test_path_is_missing file3 &&
299
- test_must_fail grep update file2 &&
299
+ ! grep update file2 &&
300
git reset --hard p4/depot/branch5 &&
301
test_path_is_file file1 &&
302
test_path_is_file file2 &&
303
test_path_is_file file3 &&
304
- test_must_fail grep update file2 &&
304
+ ! grep update file2 &&
305
test_path_is_missing .git/git-p4-tmp
306
)
307
'