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

Re: [PATCH v2 5/6] completion: refactor __gitcomp related tests

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 16, 2012, 23:40 UTC
Message-ID
<7vip95ktfy.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20121116210242.GZ12052@goldbirke>
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 12 quoted lines
> On Sun, Nov 11, 2012 at 03:35:57PM +0100, Felipe Contreras wrote:
>> Lots of duplicated code!
>> 
>> No functional changes.
>> 
>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
>> ---
>>  t/t9902-completion.sh | 76 ++++++++++++++++++---------------------------------
>>  1 file changed, 27 insertions(+), 49 deletions(-)
>
> Despite the impressive numbers, these tests are more useful without
> this cleanup.

Is this because consolidation of the duplicated part of the tests into a single helper makes it harder to instrument one test you are interested in (or developing) for debugging?

It indeed is a problem, and cutting and pasting the same code to multiple tests is one way to solve the problem (you can easily instrument the copy in the test you are interested in while leaving others intact), but I do not think that is a good solution. A bugfix or enhancement to the shared (or duplicated) part can be done by touching one place only after this change, while with the current code you have to repeat the same fix to all places, no?

Show 6 quoted lines
>> +# Test __gitcomp.
>> +# Arguments are:
>> +# 1: typed text so far (cur)
>
> The first argument is not the typed text so far, but the word
> currently containing the cursor position.

Care to update this with a follow-up patch, so that I do not have to keep track of minute details ;-)?

Previous: SZEDER GáborNext: Felipe Contreras
Message 15 of 16 in “completion: test consolidations”
  1. 0/6 completion: test consolidationsFelipe Contreras, Nov 11, 2012
  2. 1/6 completion: add comment for test_completion()Felipe Contreras, Nov 11, 2012
  3. SZEDER GáborNov 16, 2012
  4. Felipe ContrerasNov 16, 2012
  5. Felipe ContrerasNov 16, 2012
  6. 2/6 completion: standardize final space marker in testsFelipe Contreras, Nov 11, 2012
  7. 3/6 completion: simplify tests using test_completion_long()Felipe Contreras, Nov 11, 2012
  8. 4/6 completion: consolidate test_completion*() testsFelipe Contreras, Nov 11, 2012
  9. Junio C HamanoNov 16, 2012
  10. Felipe ContrerasNov 17, 2012
  11. 5/6 completion: refactor __gitcomp related testsFelipe Contreras, Nov 11, 2012
  12. Junio C HamanoNov 16, 2012
  13. Felipe ContrerasNov 16, 2012
  14. SZEDER GáborNov 16, 2012
  15. Junio C HamanoNov 16, 2012
  16. 6/6 completion: simplify __gitcomp() test helperFelipe Contreras, Nov 11, 2012

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.