Skip to content

Commit d9e6d09

Browse files
matvoregitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bc5975d commit d9e6d09

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

t/t5317-pack-objects-filter-objects.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ test_expect_success 'get an error for missing tree object' '
6969
test_must_fail git -C r5 pack-objects --rev --stdout 2>bad_tree <<-EOF &&
7070
HEAD
7171
EOF
72-
grep -q "bad tree object" bad_tree
72+
grep "bad tree object" bad_tree
7373
'
7474

7575
test_expect_success 'setup for tests of tree:0' '

t/t5616-partial-clone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ test_expect_success 'use fsck before and after manually fetching a missing subtr
192192
xargs -n1 git -C dst cat-file -t >fetched_types &&
193193
194194
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 &&
196196
test_cmp unique_types.expected unique_types.observed
197197
'
198198

t/t6112-rev-list-filters-objects.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ test_expect_success 'specify blob explicitly prevents filtering' '
3838
awk -f print_2.awk) &&
3939
4040
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
4343
'
4444

4545
test_expect_success 'verify emitted+omitted == all' '
@@ -241,7 +241,7 @@ test_expect_success 'verify tree:0 includes trees in "filtered" output' '
241241
xargs -n1 git -C r3 cat-file -t >unsorted_filtered_types &&
242242
243243
sort -u unsorted_filtered_types >filtered_types &&
244-
printf "blob\ntree\n" >expected &&
244+
test_write_lines blob tree >expected &&
245245
test_cmp expected filtered_types
246246
'
247247

0 commit comments

Comments
 (0)