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

Re: [PATCH v9 1/3] parse-options.c: make OPTION__COUNTUP consider negative values

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 28, 2016, 19:03 UTC
Message-ID
<CAPig+cR63D2L8dXJe9Gx-zFXr4-gNaFC6GdfWNPnt4d=Ds8tWg@mail.gmail.com>
In-Reply-To
<CAFZEwPP5Hq0fM3Fhg+JV-aY6bWozjL6m_bNpb=JhjkUjDJu2sw@mail.gmail.com>
On Mon, Mar 28, 2016 at 2:42 PM, Pranit Bauva <pranit.bauva@gmail.com> wrote:
Show 23 quoted lines
>> A couple of new tests to t0040-parse-options.sh would be great to
>> ensure that starting from a negative value works as advertised, i.e.
>> at least that '--option' jumps to 1 and '--no-option' resets to 0.
>
> I think adding tests to t0040-parse-options.sh cannot reflect the
> behavior introduced by this patch.
> This is because setting the initial value of the variable (which is
> going to be modified by the argument) is set in test-parse-options.c .
> A possible solution will be to modify the test-parse-options.c and
> initialize the required variable (verbose or quiet) to "unspecified"
> value. But then this will leave one part of the untested ie. when the
> initial value of the variable is 0. I could do one thing to test these
> both behaviors which is to set verbose initially to -1 and leave quiet
> = 0. Since verbose and quiet are both consumers of OPT_COUNTUP, this
> can test both the behaviors.
>
> I tried searching for alternatives but could not find any. Is there
> something else which you had thought before that would test this
> behavior?
>
> If not, then we are left with 2 options, either modify
> test-parse-options.c or just hand test it whenever there seems to be a
> problematic case.

Modifying test-parse-options.c, if needed, was implied by SZEDER's suggestion to add tests for this new behavior. test-parse-options.c exists strictly for testing option parsing, so don't feel constrained about modifying or extending it in order to test the new count-up behavior if the existing implementation doesn't directly support what you want it to do.

Previous: Pranit Bauva
Message 23 of 23 in “parse-options.c: make OPTION__COUNTUP consider negative values”
  1. 1/3 parse-options.c: make OPTION__COUNTUP consider negative valuesPranit Bauva, Mar 24, 2016
  2. 2/3 t7507-commit-verbose: make test suite use write_scriptPranit Bauva, Mar 24, 2016
  3. 2/3 t7507-commit-verbose: make test suite use write_scriptSZEDER Gábor, Mar 24, 2016
  4. Eric SunshineMar 24, 2016
  5. Pranit BauvaMar 25, 2016
  6. Eric SunshineMar 25, 2016
  7. Pranit BauvaMar 25, 2016
  8. SZEDER GáborMar 25, 2016
  9. Pranit BauvaMar 25, 2016
  10. Eric SunshineMar 25, 2016
  11. Pranit BauvaMar 25, 2016
  12. Eric SunshineMar 25, 2016
  13. 3/3 commit: add a commit.verbose config variablePranit Bauva, Mar 24, 2016
  14. SZEDER GáborMar 24, 2016
  15. Pranit BauvaMar 24, 2016
  16. Pranit BauvaMar 24, 2016
  17. Eric SunshineMar 25, 2016
  18. Pranit BauvaMar 25, 2016
  19. 1/3 parse-options.c: make OPTION__COUNTUP consider negative valuesSZEDER Gábor, Mar 24, 2016
  20. Pranit BauvaMar 24, 2016
  21. Eric SunshineMar 24, 2016
  22. Pranit BauvaMar 28, 2016
  23. Eric SunshineMar 28, 2016

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.