On Mon, Mar 28, 2016 at 2:42 PM, Pranit Bauva <pranit.bauva@xxxxxxxxx> wrote: >> 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. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html