Re: [PATCH v2] t4018: introduce test cases for the internal hunk header patterns
- From
Brandon Casey <drafnel@gmail.com>
- Date
- Dec 20, 2011, 15:58 UTC
- Message-ID
- <CA+sFfMd95-T9K2CztByo7d9Yn-RN58oYfAz0ZA1Gp+84oBBs2g@mail.gmail.com>
- In-Reply-To
- <m3pqfjfy42.fsf@localhost.localdomain>
On Tue, Dec 20, 2011 at 2:25 AM, Jakub Narebski <jnareb@gmail.com> wrote:
Show 29 quoted lines
> Brandon Casey <drafnel@gmail.com> writes:
>
>> diff --git a/t/t4018/ignore_global.cpp b/t/t4018/ignore_global.cpp
>> new file mode 100644
>> index 0000000..95e23bc
>> --- /dev/null
>> +++ b/t/t4018/ignore_global.cpp
>> @@ -0,0 +1,19 @@
>> +int WRONG_function_hunk_header_preceding_the_right_one (void)
>> +{
>> + return 0;
>> +}
>> +
>> +int RIGHT_function_hunk_header (void)
>> +{
>> + printf("Hello, world\n");
>> + return 0;
>> +}
>> +
>> +int WRONG_global_variable;
>> +
>> +int ChangeMe;
>> +
>> +int WRONG_function_hunk_header_following_the_right_one (void)
>> +{
>> + return 0;
>> +}
>
> Shouldn't ChangeMe be inside function?No, this one is placed here after the WRONG_global_variable to make sure that a global variable is not chosen for the hunk header. It should chose the most recently encountered function name for the hunk header, which is RIGHT_function_hunk_header.
Show 16 quoted lines
>> diff --git a/t/t4018/simple.cpp b/t/t4018/simple.cpp >> new file mode 100644 >> index 0000000..c96ad87 >> --- /dev/null >> +++ b/t/t4018/simple.cpp >> @@ -0,0 +1,32 @@ >> +/* >> + * Test file for testing the internal hunk header patterns >> + * >> + * The "RIGHT" hunk header function, the one that should appear on the >> + * hunk header line, should be named "RIGHT_function_hunk_header" and >> + * the body of this function should have an assignment that looks like >> + * >> + * answer = 0 > > Shouldn't it be ChangeMe?
Whoops, I forgot about that text. Thanks for noticing. Yes this is incorrect now. I think I'll break that out into a README file.
v3 forthcoming.
-Brandon