t7800: replace "wc -l" with test_line_count

Make t7800 easier to debug by capturing output into temporary files and using test_line_count to make assertions on those files. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

David Aguilar committed Feb 7, 2017 at 01:17 UTC 1ce515f09d2bb0836ee100b4d48e9496f5cdde95
1 file changed +19 -12
t/t7800-difftool.sh
+19 -12
@@ -290,8 +290,8 @@ test_expect_success 'difftool + mergetool config variables' '
290 test_expect_success 'difftool.<tool>.path' '
291 test_config difftool.tkdiff.path echo &&
292 git difftool --tool=tkdiff --no-prompt branch >output &&
293 - lines=$(grep file output | wc -l) &&
294 - test "$lines" -eq 1
293 + grep file output >grep-output &&
294 + test_line_count = 1 grep-output
295 '
296
297 test_expect_success 'difftool --extcmd=cat' '
@@ -428,9 +428,12 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory' '
428 git difftool --dir-diff $symlinks --extcmd ls branch >output &&
429 # "sub" must only exist in "right"
430 # "file" and "file2" must be listed in both "left" and "right"
431 - test "1" = $(grep sub output | wc -l) &&
432 - test "2" = $(grep file"$" output | wc -l) &&
433 - test "2" = $(grep file2 output | wc -l)
431 + grep sub output > sub-output &&
432 + test_line_count = 1 sub-output &&
433 + grep file"$" output >file-output &&
434 + test_line_count = 2 file-output &&
435 + grep file2 output >file2-output &&
436 + test_line_count = 2 file2-output
437 )
438 '
439
@@ -440,9 +443,11 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory' '
443 git difftool --dir-diff $symlinks --extcmd ls v1 >output &&
444 # "sub" and "file" exist in both v1 and HEAD.
445 # "file2" is unchanged.
443 - test "2" = $(grep sub output | wc -l) &&
444 - test "2" = $(grep file output | wc -l) &&
445 - test "0" = $(grep file2 output | wc -l)
446 + grep sub output >sub-output &&
447 + test_line_count = 2 sub-output &&
448 + grep file output >file-output &&
449 + test_line_count = 2 file-output &&
450 + ! grep file2 output
451 )
452 '
453
@@ -452,8 +457,9 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory w/ pathspec' '
457 git difftool --dir-diff $symlinks --extcmd ls branch -- .>output &&
458 # "sub" only exists in "right"
459 # "file" and "file2" must not be listed
455 - test "1" = $(grep sub output | wc -l) &&
456 - test "0" = $(grep file output | wc -l)
460 + grep sub output >sub-output &&
461 + test_line_count = 1 sub-output &&
462 + ! grep file output
463 )
464 '
465
@@ -463,8 +469,9 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory w/ pathspec' '
469 git difftool --dir-diff $symlinks --extcmd ls v1 -- .>output &&
470 # "sub" exists in v1 and HEAD
471 # "file" is filtered out by the pathspec
466 - test "2" = $(grep sub output | wc -l) &&
467 - test "0" = $(grep file output | wc -l)
472 + grep sub output >sub-output &&
473 + test_line_count = 2 sub-output &&
474 + ! grep file output
475 )
476 '
477