t0040-parse-options: improve test coverage

Include tests to check for multiple levels of quiet and to check the behavior of '--no-quiet'. Include tests to check for multiple levels of verbose and to check the behavior of '--no-verbose'. Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pranit Bauva committed May 5, 2016 at 15:19 UTC 7d1771524c8bc39856f7b30769c2f47c6061ba2f
1 file changed +114
t/t0040-parse-options.sh
+114
@@ -476,4 +476,118 @@ test_expect_success '--no-list resets list' '
476 test_cmp expect output
477 '
478
479 +cat >expect <<\EOF
480 +boolean: 0
481 +integer: 0
482 +magnitude: 0
483 +timestamp: 0
484 +string: (not set)
485 +abbrev: 7
486 +verbose: 0
487 +quiet: 3
488 +dry run: no
489 +file: (not set)
490 +EOF
491 +
492 +test_expect_success 'multiple quiet levels' '
493 + test-parse-options -q -q -q >output 2>output.err &&
494 + test_must_be_empty output.err &&
495 + test_cmp expect output
496 +'
497 +
498 +cat >expect <<\EOF
499 +boolean: 0
500 +integer: 0
501 +magnitude: 0
502 +timestamp: 0
503 +string: (not set)
504 +abbrev: 7
505 +verbose: 3
506 +quiet: 0
507 +dry run: no
508 +file: (not set)
509 +EOF
510 +
511 +test_expect_success 'multiple verbose levels' '
512 + test-parse-options -v -v -v >output 2>output.err &&
513 + test_must_be_empty output.err &&
514 + test_cmp expect output
515 +'
516 +
517 +cat >expect <<\EOF
518 +boolean: 0
519 +integer: 0
520 +magnitude: 0
521 +timestamp: 0
522 +string: (not set)
523 +abbrev: 7
524 +verbose: 0
525 +quiet: 0
526 +dry run: no
527 +file: (not set)
528 +EOF
529 +
530 +test_expect_success '--no-quiet sets --quiet to 0' '
531 + test-parse-options --no-quiet >output 2>output.err &&
532 + test_must_be_empty output.err &&
533 + test_cmp expect output
534 +'
535 +
536 +cat >expect <<\EOF
537 +boolean: 0
538 +integer: 0
539 +magnitude: 0
540 +timestamp: 0
541 +string: (not set)
542 +abbrev: 7
543 +verbose: 0
544 +quiet: 0
545 +dry run: no
546 +file: (not set)
547 +EOF
548 +
549 +test_expect_success '--no-quiet resets multiple -q to 0' '
550 + test-parse-options -q -q -q --no-quiet >output 2>output.err &&
551 + test_must_be_empty output.err &&
552 + test_cmp expect output
553 +'
554 +
555 +cat >expect <<\EOF
556 +boolean: 0
557 +integer: 0
558 +magnitude: 0
559 +timestamp: 0
560 +string: (not set)
561 +abbrev: 7
562 +verbose: 0
563 +quiet: 0
564 +dry run: no
565 +file: (not set)
566 +EOF
567 +
568 +test_expect_success '--no-verbose sets verbose to 0' '
569 + test-parse-options --no-verbose >output 2>output.err &&
570 + test_must_be_empty output.err &&
571 + test_cmp expect output
572 +'
573 +
574 +cat >expect <<\EOF
575 +boolean: 0
576 +integer: 0
577 +magnitude: 0
578 +timestamp: 0
579 +string: (not set)
580 +abbrev: 7
581 +verbose: 0
582 +quiet: 0
583 +dry run: no
584 +file: (not set)
585 +EOF
586 +
587 +test_expect_success '--no-verbose resets multiple verbose to 0' '
588 + test-parse-options -v -v -v --no-verbose >output 2>output.err &&
589 + test_must_be_empty output.err &&
590 + test_cmp expect output
591 +'
592 +
593 test_done