On Sat, Apr 30, 2016 at 4:03 PM, Pranit Bauva <[email protected]> wrote:
> Include tests to check for multiple levels of quiet and to check if the
> '--no-quiet' option sets it to 0.

As this patch is also adding a test of --[no-]verbose, the commit
message should mention it.

More below...

> Signed-off-by: Pranit Bauva <[email protected]>
> ---
> diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
> @@ -476,4 +476,61 @@ test_expect_success '--no-list resets list' '
> +test_expect_success 'multiple quiet levels' '
> +       test-parse-options -q -q -q >output 2>output.err &&
> +       test_must_be_empty output.err &&
> +       test_cmp expect output
> +'
> +
> +test_expect_success '--no-quiet sets quiet to 0' '
> +       test-parse-options -q -q -q --no-quiet >output 2>output.err &&
> +       test_must_be_empty output.err &&
> +       test_cmp expect output
> +'

It wouldn't hurt to have two tests for --no-quiet: one which tests
--no-quiet alone to ensure that 'quiet' *remains* at 0, and one which
tests --no-quiet in combination with some --quiet's to ensure that
'quiet' is *reset* to 0. These tests would give you good coverage for
changes by subsequent patches, such as the OPTION_COUNTUP patch which
flips the initial value to -1.

> +
> +test_expect_success '--no-verbose sets verbose to 0' '
> +       test-parse-options --no-verbose >output 2> output.err &&
> +       test_must_be_empty output.err &&
> +       test_cmp expect output
> +'

One would expect to see 'verbose' get the same treatment of having a
test invoke --verbose multiple times. (Yes, I realize that the "long
options" test does just this, but testing multiple --verbose's is not
its primary purpose, so having a test which does test multiple
--verbose's as its primary purpose can be beneficial and is less
likely to be broken by someone in the future.)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to