filter-trees: code clean-up of tests

A few trivial updates to test to match the current best practices. - avoid "grep -q" that strips potentially useful output from tests running under "-v". - use test_write_lines to prepare multi-line expected output file. - reserve use of test_must_fail to "git" commands. Signed-off-by: Matthew DeVore <matvore@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Matthew DeVore committed Oct 12, 2018 at 13:01 UTC d9e6d0942bb9f9fe9e4cca9670181e5b59074bcb
3 files changed +5 -5
t/t5317-pack-objects-filter-objects.sh
+1 -1
@@ -69,7 +69,7 @@ test_expect_success 'get an error for missing tree object' '
69 test_must_fail git -C r5 pack-objects --rev --stdout 2>bad_tree <<-EOF &&
70 HEAD
71 EOF
72 - grep -q "bad tree object" bad_tree
72 + grep "bad tree object" bad_tree
73 '
74
75 test_expect_success 'setup for tests of tree:0' '
t/t5616-partial-clone.sh
+1 -1
@@ -192,7 +192,7 @@ test_expect_success 'use fsck before and after manually fetching a missing subtr
192 xargs -n1 git -C dst cat-file -t >fetched_types &&
193
194 sort -u fetched_types >unique_types.observed &&
195 - printf "blob\ncommit\ntree\n" >unique_types.expected &&
195 + test_write_lines blob commit tree >unique_types.expected &&
196 test_cmp unique_types.expected unique_types.observed
197 '
198
t/t6112-rev-list-filters-objects.sh
+3 -3
@@ -38,8 +38,8 @@ test_expect_success 'specify blob explicitly prevents filtering' '
38 awk -f print_2.awk) &&
39
40 git -C r1 rev-list --objects --filter=blob:none HEAD $file_3 >observed &&
41 - grep -q "$file_3" observed &&
42 - test_must_fail grep -q "$file_4" observed
41 + grep "$file_3" observed &&
42 + ! grep "$file_4" observed
43 '
44
45 test_expect_success 'verify emitted+omitted == all' '
@@ -241,7 +241,7 @@ test_expect_success 'verify tree:0 includes trees in "filtered" output' '
241 xargs -n1 git -C r3 cat-file -t >unsorted_filtered_types &&
242
243 sort -u unsorted_filtered_types >filtered_types &&
244 - printf "blob\ntree\n" >expected &&
244 + test_write_lines blob tree >expected &&
245 test_cmp expected filtered_types
246 '
247