]> git.ipfire.org Git - thirdparty/git.git/commitdiff
filter-trees: code clean-up of tests
authorMatthew DeVore <matvore@google.com>
Fri, 12 Oct 2018 20:01:41 +0000 (13:01 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Oct 2018 03:43:17 +0000 (12:43 +0900)
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>
t/t5317-pack-objects-filter-objects.sh
t/t5616-partial-clone.sh
t/t6112-rev-list-filters-objects.sh

index 510d3537f6a13b2b6066fe745227e9983c42f3c3..d9dccf4d4db8be7f3f727d394c320b3e30b04728 100755 (executable)
@@ -69,7 +69,7 @@ test_expect_success 'get an error for missing tree object' '
        test_must_fail git -C r5 pack-objects --rev --stdout 2>bad_tree <<-EOF &&
        HEAD
        EOF
-       grep -q "bad tree object" bad_tree
+       grep "bad tree object" bad_tree
 '
 
 test_expect_success 'setup for tests of tree:0' '
index 53fbf7db887e5cba8243be18d022d10412e05493..392caa08fd8a3612a3b641a094856e48fcfd5d3f 100755 (executable)
@@ -192,7 +192,7 @@ test_expect_success 'use fsck before and after manually fetching a missing subtr
        xargs -n1 git -C dst cat-file -t >fetched_types &&
 
        sort -u fetched_types >unique_types.observed &&
-       printf "blob\ncommit\ntree\n" >unique_types.expected &&
+       test_write_lines blob commit tree >unique_types.expected &&
        test_cmp unique_types.expected unique_types.observed
 '
 
index 2cbb81d3bbcd7a5c7aec8b73f244cb10a1c8eb15..d24f9d5b5a48544708213c4c9cbd920953dcfee2 100755 (executable)
@@ -38,8 +38,8 @@ test_expect_success 'specify blob explicitly prevents filtering' '
                 awk -f print_2.awk) &&
 
        git -C r1 rev-list --objects --filter=blob:none HEAD $file_3 >observed &&
-       grep -q "$file_3" observed &&
-       test_must_fail grep -q "$file_4" observed
+       grep "$file_3" observed &&
+       ! grep "$file_4" observed
 '
 
 test_expect_success 'verify emitted+omitted == all' '
@@ -241,7 +241,7 @@ test_expect_success 'verify tree:0 includes trees in "filtered" output' '
        xargs -n1 git -C r3 cat-file -t >unsorted_filtered_types &&
 
        sort -u unsorted_filtered_types >filtered_types &&
-       printf "blob\ntree\n" >expected &&
+       test_write_lines blob tree >expected &&
        test_cmp expected filtered_types
 '