Re: [PATCH] t3000 (ls-files -o): modernize style

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 11, 2010 at 08:33, Jakub Narebski <jnareb@xxxxxxxxx> wrote:
> Jonathan Nieder <jrnieder@xxxxxxxxx> writes:
>
>> This script is part of the second batch of tests, from the same day
>> the test infrastructure was added to git.  Update it to use a more
>> modern style in the spirit of v1.6.4-rc0~45^2~2 (2009-05-22).
>> In particular:

On the patch:

    Acked-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>

>>  - Put setup code inside test assertions, to avoid unexpected
>>    breakages and avoid stray output without -v (as t/README
>>    recommends); and
>
> O.K., but...
>
>> -cat >expected1 <<EOF
>> -expected1
>> -expected2
>> -expected3
>> -output
>> -path0
>> -path1
>> -path2-junk
>> -path2/file2
>> -EOF
>> -sed -e 's|path2/file2|path2/|' <expected1 >expected2
>> -cat <expected2 >expected3
>> -echo path4/ >>expected2
>> -
>> +test_expect_success 'setup: expected output' '
>> +     cat >expected1 <<-\EOF &&
>> +     expected1
>> +     expected2
>> +     expected3
>> +     output
>> +     path0
>> +     path1
>> +     path2-junk
>> +     path2/file2
>> +     EOF
>> +
>> +     sed -e "s|path2/file2|path2/|" <expected1 >expected2 &&
>> +     cp expected2 expected3 &&
>> +     echo path4/ >>expected2
>> +'
>
> ... I don't think it is really needed.  There isn't anything there
> that can fail, and there isn't anything there that produces any
> output.

The disk could fill up. In any case I like the test style of using
setup tests instead of stray setup code inside the tests themselves.

> BTW. do all sane shells that can be used to run test suite support
> '<<-' here-doc redirection operators?  Is it in POSIX?

I don't know. But it's POSIX enough that nobody's complained about it
thus far, it's used in a lot of existing code:

    $ ack -l '<<-EOF'
    t/t1012-read-tree-df.sh
    t/t7005-editor.sh
    t/t3507-cherry-pick-conflict.sh
    t/t7401-submodule-summary.sh
    t/t7201-co.sh
    t/t4132-apply-removal.sh
    t/t4041-diff-submodule-option.sh
    contrib/hooks/post-receive-email
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]