git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Brandon Casey <drafnel@gmail.com>
Date
Dec 19, 2011, 22:57 UTC
Message-ID
<CA+sFfMeogJ==ud6NdPj_KZFUKFeB--RBmPkLndjrQwhg15V5ig@mail.gmail.com>
In-Reply-To
<7vty4wkx19.fsf@alter.siamese.dyndns.org>
On Mon, Dec 19, 2011 at 4:37 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> Brandon Casey <casey@nrlssc.navy.mil> 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.

Show 12 quoted lines
> 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.
Show 14 quoted lines
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 21 of 35 in “attr: map builtin userdiff drivers to well-known extensions”
  1. attr: map builtin userdiff drivers to well-known extensionsJeff King, Dec 16, 2011
  2. Johannes SixtDec 16, 2011
  3. Junio C HamanoDec 16, 2011
  4. Jeff KingDec 16, 2011
  5. Jeff KingDec 16, 2011
  6. Junio C HamanoDec 16, 2011
  7. Jeff KingDec 17, 2011
  8. Johannes SixtDec 16, 2011
  9. Jeff KingDec 17, 2011
  10. Jonathan NiederDec 17, 2011
  11. 1/2 attr: map builtin userdiff drivers to well-known extensionsJeff King, Dec 19, 2011
  12. Jonathan NiederDec 19, 2011
  13. Jeff KingDec 19, 2011
  14. Ævar Arnfjörð BjarmasonDec 22, 2011
  15. 2/2 attr: drop C/C++ default extension mappingJeff King, Dec 19, 2011
  16. Jonathan NiederDec 19, 2011
  17. Thomas RastDec 19, 2011
  18. t4018: introduce test cases for the internal hunk header patternsBrandon Casey, Dec 19, 2011
  19. t4018: add a few more test cases for cpp hunk header matchingBrandon Casey, Dec 19, 2011
  20. Junio C HamanoDec 19, 2011
  21. Brandon CaseyDec 19, 2011
  22. Junio C HamanoDec 19, 2011
  23. t4018: introduce test cases for the internal hunk header patternsBrandon Casey, Dec 20, 2011
  24. Jakub NarebskiDec 20, 2011
  25. Brandon CaseyDec 20, 2011
  26. Thomas RastDec 20, 2011
  27. Johannes SixtDec 20, 2011
  28. Junio C HamanoDec 20, 2011
  29. Mark LevedahlDec 16, 2011
  30. Jeff KingDec 16, 2011
  31. Philip OakleyDec 16, 2011
  32. Jeff KingDec 16, 2011
  33. Philip OakleyDec 21, 2011
  34. Jeff KingDec 23, 2011
  35. Junio C HamanoDec 16, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.