Re: [PATCH] t4018: introduce test cases for the internal hunk header patterns

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

 



On Mon, Dec 19, 2011 at 4:37 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Brandon Casey <casey@xxxxxxxxxxxxxxx> writes:
>>    * test cases must provide a function named "RIGHT_function_hunk_header"
>>      - this is the function name that should appear on the hunk header line
>>      - the body of this function should have an assignment like
>>
>>           answer = 0
>>
>>        The test suite will modify the above line to produce a difference
>>        from the original.  Additionally, this should be far enough within
>>        the body of the function so that the function name is not part of
>>        the lines of context.
>
> Although I do not think of any language with a syntax rule where that the
> overlong RIGHT_func... token is an illegal symbol offhand, this feels a
> bit _too_ specific to the C language.

Good point.  "RIGHT_function_hunk_header" doesn't really have much
meaning for non-programming language patterns like tex and html.

> I would prefer something like this
> instead:
>
>    * a test case must have one (and only one) line that contains "RIGHT"
>      (all uppercase) and that line should become the hunk header for the
>      test to succeed.
>
>    * after the line that contains "RIGHT" token, there should be one (and
>      only one) line that contains "ChangeMe". The test modifies this
>      token to "IWasChanged", compares the original with the modified
>      result, and expects the "RIGHT" token above appears on the hunk
>      header.

Both good improvements.

> Also I would prefer not to require "enough filler", as we might want to
> enhance the logic to consider using a line in the pre-context as the hunk
> header in some cases, e.g.
>
>    @@ ... @@ int RIGHT_function_hunk_header(void)
>
>     int RIGHT_function_hunk_header(void)
>     {
>    -    int ChangeME;
>    +    int IWasChanged;
>         printf("Hello, world\n");
>         return 0;
>     }
>    @@ ...

Yeah, I didn't mean to imply that "enough filler" was a requirement of
the test, just trying to point out the requirement imposed by the hunk
header logic.  I'll remove this statement.

Will reroll.

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