Re: [PATCH] t4069: test diff behavior with i-t-a paths

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

 



On Mon, Aug 10, 2020 at 12:23 PM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> To tighten this test, perhaps it makes sense to take a different
> approach and check the exact output rather than merely grepping for a
> particular string. In other words, something like this might be better
> (typed in email, so untested):
>
>     cat >expect <<-\EOF &&
>     diff --git a/test-file b/test-file
>     index HEX..HEX HEX
>     --- a/test-file
>     +++ b/test-file
>     EOF
>     cat blueprint >test-file &&
>     git diff --ita-visible-in-index -- test-file >raw &&
>     sed "s/[0-9a-f][0-9a-f]*/HEX/g' raw >actual &&
>     test_cmp expect actual

This can be improved by taking advantage of the OID_REGEX variable
defined by the test suite for matching an OID. So something like this
would be even better:

    cat >expect <<-\EOF &&
    diff --git a/test-file b/test-file
    index OID..OID 100644
    --- a/test-file
    +++ b/test-file
    EOF
    cat blueprint >test-file &&
    git diff --ita-visible-in-index -- test-file >raw &&
    sed "s/$OID_REGEX/OID/g" raw >actual &&
    test_cmp expect actual



[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]

  Powered by Linux