From: Brandon Casey Date: Tue, 20 Dec 2011 15:58:37 GMT Subject: Re: [PATCH v2] t4018: introduce test cases for the internal hunk header patterns Message-ID: In-Reply-To: On Tue, Dec 20, 2011 at 2:25 AM, Jakub Narebski wrote: > Brandon Casey 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. >> 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