Subject: Re: [PATCH v10 4/4] t1006: add tests for git cat-file --allow-unknown-type

From: karthik nayak <[email-masked]>
Date: Tue, 05 May 2015 07:53:00 +0530

On 05/05/2015 07:03 AM, Eric Sunshine wrote:
> On Sun, May 3, 2015 at 10:30 AM, Karthik Nayak <[email-masked]> wrote:
>> Signed-off-by: Karthik Nayak <[email-masked]>
>> ---
>>   t/t1006-cat-file.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 45 insertions(+)
>>
>> diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
>> index ab36b1e..de8eaf1 100755
>> --- a/t/t1006-cat-file.sh
>> +++ b/t/t1006-cat-file.sh
>> @@ -47,6 +47,18 @@ $content"
>>          test_cmp expect actual
>>       '
>>
>> +    test_expect_success "Type of $type is correct using --allow-unknown-type" '
>> +       echo $type >expect &&
>> +    git cat-file -t --allow-unknown-type $sha1 >actual &&
>
> Indentation is still botched in this test and the next one (as
> mentioned previously [1]).
>
> [1]: http://article.gmane.org/gmane.comp.version-control.git/268005
It only seems to have affected the test file, I made sure the 
indentation was correct after your previous suggestion, I have to see 
why this is happening. Thanks
>
>> +       test_cmp expect actual
>> +    '
>> +
>> +    test_expect_success "Size of $type is correct using --allow-unknown-type" '
>> +       echo $size >expect &&
>> +    git cat-file -s --allow-unknown-type $sha1 >actual &&
>> +       test_cmp expect actual
>> +    '
>> +
>>       test -z "$content" ||
>>       test_expect_success "Content of $type is correct" '
>>          maybe_remove_timestamp "$content" $no_ts >expect &&
>> @@ -296,4 +308,37 @@ test_expect_success '%(deltabase) reports packed delta bases' '
>>          }
>>   '
>>
>> +bogus_type="bogus"
>> +bogus_content="bogus"
>> +bogus_size=$(strlen "$bogus_content")
>> +bogus_sha1=$(echo_without_newline "$bogus_content" | git hash-object -t $bogus_type --literally -w --stdin)
>> +
>> +test_expect_success "Type of broken object is correct" '
>> +       echo $bogus_type >expect &&
>> +       git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&
>> +       test_cmp expect actual
>> +'
>> +
>> +test_expect_success "Size of broken object is correct" '
>> +       echo $bogus_size >expect &&
>> +       git cat-file -s --allow-unknown-type $bogus_sha1 >actual &&
>> +       test_cmp expect actual
>> +'
>> +bogus_type="abcdefghijklmnopqrstuvwxyz1234679"
>> +bogus_content="bogus"
>> +bogus_size=$(strlen "$bogus_content")
>> +bogus_sha1=$(echo_without_newline "$bogus_content" | git hash-object -t $bogus_type --literally -w --stdin)
>> +
>> +test_expect_success "Type of broken object is correct when type is large" '
>> +       echo $bogus_type >expect &&
>> +       git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&
>> +       test_cmp expect actual
>> +'
>> +
>> +test_expect_success "Size of large broken object is correct when type is large" '
>> +       echo $bogus_size >expect &&
>> +       git cat-file -s --allow-unknown-type $bogus_sha1 >actual &&
>> +       test_cmp expect actual
>> +'
>> +
>>   test_done
>> --
>> 2.4.0.rc1.250.gfbd73bd