Commit 8635c4d0eb458621a294a0851ba9736f025e29b7

Authored by Henry Fredrick Schreiner
Committed by Henry Schreiner
1 parent 3cb75b90

Dropping reset in favor of clear

include/CLI/App.hpp
@@ -878,6 +878,21 @@ class App { @@ -878,6 +878,21 @@ class App {
878 ///@} 878 ///@}
879 /// @name Parsing 879 /// @name Parsing
880 ///@{ 880 ///@{
  881 + //
  882 + /// Reset the parsed data
  883 + void clear() {
  884 +
  885 + parsed_ = false;
  886 + missing_.clear();
  887 + parsed_subcommands_.clear();
  888 +
  889 + for(const Option_p &opt : options_) {
  890 + opt->clear();
  891 + }
  892 + for(const App_p &app : subcommands_) {
  893 + app->clear();
  894 + }
  895 + }
881 896
882 /// Parses the command line - throws errors 897 /// Parses the command line - throws errors
883 /// This must be called after the options are in but before the rest of the program. 898 /// This must be called after the options are in but before the rest of the program.
@@ -895,6 +910,10 @@ class App { @@ -895,6 +910,10 @@ class App {
895 /// The real work is done here. Expects a reversed vector. 910 /// The real work is done here. Expects a reversed vector.
896 /// Changes the vector to the remaining options. 911 /// Changes the vector to the remaining options.
897 void parse(std::vector<std::string> &args) { 912 void parse(std::vector<std::string> &args) {
  913 + // Clear if parsed
  914 + if(parsed_)
  915 + clear();
  916 +
898 _validate(); 917 _validate();
899 _parse(args); 918 _parse(args);
900 run_callback(); 919 run_callback();
@@ -930,21 +949,6 @@ class App { @@ -930,21 +949,6 @@ class App {
930 return e.get_exit_code(); 949 return e.get_exit_code();
931 } 950 }
932 951
933 - /// Reset the parsed data  
934 - void reset() {  
935 -  
936 - parsed_ = false;  
937 - missing_.clear();  
938 - parsed_subcommands_.clear();  
939 -  
940 - for(const Option_p &opt : options_) {  
941 - opt->clear();  
942 - }  
943 - for(const App_p &app : subcommands_) {  
944 - app->reset();  
945 - }  
946 - }  
947 -  
948 ///@} 952 ///@}
949 /// @name Post parsing 953 /// @name Post parsing
950 ///@{ 954 ///@{
tests/AppTest.cpp
@@ -152,13 +152,10 @@ TEST_F(TApp, BoolAndIntFlags) { @@ -152,13 +152,10 @@ TEST_F(TApp, BoolAndIntFlags) {
152 EXPECT_EQ(1, iflag); 152 EXPECT_EQ(1, iflag);
153 EXPECT_EQ((unsigned int)1, uflag); 153 EXPECT_EQ((unsigned int)1, uflag);
154 154
155 - app.reset();  
156 -  
157 args = {"-b", "-b"}; 155 args = {"-b", "-b"};
158 - EXPECT_NO_THROW(run()); 156 + ASSERT_NO_THROW(run());
159 EXPECT_TRUE(bflag); 157 EXPECT_TRUE(bflag);
160 158
161 - app.reset();  
162 bflag = false; 159 bflag = false;
163 160
164 args = {"-iiiuu"}; 161 args = {"-iiiuu"};
@@ -173,11 +170,9 @@ TEST_F(TApp, BoolOnlyFlag) { @@ -173,11 +170,9 @@ TEST_F(TApp, BoolOnlyFlag) {
173 app.add_flag("-b", bflag)->multi_option_policy(CLI::MultiOptionPolicy::Throw); 170 app.add_flag("-b", bflag)->multi_option_policy(CLI::MultiOptionPolicy::Throw);
174 171
175 args = {"-b"}; 172 args = {"-b"};
176 - EXPECT_NO_THROW(run()); 173 + ASSERT_NO_THROW(run());
177 EXPECT_TRUE(bflag); 174 EXPECT_TRUE(bflag);
178 175
179 - app.reset();  
180 -  
181 args = {"-b", "-b"}; 176 args = {"-b", "-b"};
182 EXPECT_THROW(run(), CLI::ConversionError); 177 EXPECT_THROW(run(), CLI::ConversionError);
183 } 178 }
@@ -331,8 +326,7 @@ TEST_F(TApp, MissingValueNonRequiredOpt) { @@ -331,8 +326,7 @@ TEST_F(TApp, MissingValueNonRequiredOpt) {
331 326
332 args = {"-c"}; 327 args = {"-c"};
333 EXPECT_THROW(run(), CLI::ArgumentMismatch); 328 EXPECT_THROW(run(), CLI::ArgumentMismatch);
334 -  
335 - app.reset(); 329 + app.clear();
336 330
337 args = {"--count"}; 331 args = {"--count"};
338 EXPECT_THROW(run(), CLI::ArgumentMismatch); 332 EXPECT_THROW(run(), CLI::ArgumentMismatch);
@@ -346,8 +340,7 @@ TEST_F(TApp, MissingValueMoreThan) { @@ -346,8 +340,7 @@ TEST_F(TApp, MissingValueMoreThan) {
346 340
347 args = {"-v", "2"}; 341 args = {"-v", "2"};
348 EXPECT_THROW(run(), CLI::ArgumentMismatch); 342 EXPECT_THROW(run(), CLI::ArgumentMismatch);
349 -  
350 - app.reset(); 343 + app.clear();
351 344
352 args = {"--vals", "4"}; 345 args = {"--vals", "4"};
353 EXPECT_THROW(run(), CLI::ArgumentMismatch); 346 EXPECT_THROW(run(), CLI::ArgumentMismatch);
@@ -363,8 +356,6 @@ TEST_F(TApp, NoMissingValueMoreThan) { @@ -363,8 +356,6 @@ TEST_F(TApp, NoMissingValueMoreThan) {
363 run(); 356 run();
364 EXPECT_EQ(vals1, std::vector<int>({2, 3, 4})); 357 EXPECT_EQ(vals1, std::vector<int>({2, 3, 4}));
365 358
366 - app.reset();  
367 -  
368 args = {"--vals", "2", "3", "4"}; 359 args = {"--vals", "2", "3", "4"};
369 run(); 360 run();
370 EXPECT_EQ(vals2, std::vector<int>({2, 3, 4})); 361 EXPECT_EQ(vals2, std::vector<int>({2, 3, 4}));
@@ -419,7 +410,7 @@ TEST_F(TApp, RequiredOptsDouble) { @@ -419,7 +410,7 @@ TEST_F(TApp, RequiredOptsDouble) {
419 410
420 EXPECT_THROW(run(), CLI::ArgumentMismatch); 411 EXPECT_THROW(run(), CLI::ArgumentMismatch);
421 412
422 - app.reset(); 413 + app.clear();
423 args = {"--str", "one", "two"}; 414 args = {"--str", "one", "two"};
424 415
425 run(); 416 run();
@@ -435,8 +426,7 @@ TEST_F(TApp, RequiredOptsDoubleShort) { @@ -435,8 +426,7 @@ TEST_F(TApp, RequiredOptsDoubleShort) {
435 args = {"-s", "one"}; 426 args = {"-s", "one"};
436 427
437 EXPECT_THROW(run(), CLI::ArgumentMismatch); 428 EXPECT_THROW(run(), CLI::ArgumentMismatch);
438 -  
439 - app.reset(); 429 + app.clear();
440 430
441 args = {"-s", "one", "-s", "one", "-s", "one"}; 431 args = {"-s", "one", "-s", "one", "-s", "one"};
442 432
@@ -450,20 +440,15 @@ TEST_F(TApp, RequiredOptsDoubleNeg) { @@ -450,20 +440,15 @@ TEST_F(TApp, RequiredOptsDoubleNeg) {
450 args = {"-s", "one"}; 440 args = {"-s", "one"};
451 441
452 EXPECT_THROW(run(), CLI::ArgumentMismatch); 442 EXPECT_THROW(run(), CLI::ArgumentMismatch);
453 -  
454 - app.reset(); 443 + app.clear();
455 444
456 args = {"-s", "one", "two", "-s", "three"}; 445 args = {"-s", "one", "two", "-s", "three"};
457 446
458 - EXPECT_NO_THROW(run());  
459 - 447 + ASSERT_NO_THROW(run());
460 EXPECT_EQ(strs, std::vector<std::string>({"one", "two", "three"})); 448 EXPECT_EQ(strs, std::vector<std::string>({"one", "two", "three"}));
461 449
462 - app.reset();  
463 args = {"-s", "one", "two"}; 450 args = {"-s", "one", "two"};
464 -  
465 - EXPECT_NO_THROW(run());  
466 - 451 + ASSERT_NO_THROW(run());
467 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"})); 452 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"}));
468 } 453 }
469 454
@@ -483,7 +468,6 @@ TEST_F(TApp, PositionalNoSpace) { @@ -483,7 +468,6 @@ TEST_F(TApp, PositionalNoSpace) {
483 EXPECT_EQ(options.size(), (size_t)1); 468 EXPECT_EQ(options.size(), (size_t)1);
484 EXPECT_EQ(options.at(0), "Test"); 469 EXPECT_EQ(options.at(0), "Test");
485 470
486 - app.reset();  
487 args = {"-OTest", "param1", "param2"}; 471 args = {"-OTest", "param1", "param2"};
488 run(); 472 run();
489 473
@@ -505,7 +489,6 @@ TEST_F(TApp, PositionalNoSpaceLong) { @@ -505,7 +489,6 @@ TEST_F(TApp, PositionalNoSpaceLong) {
505 EXPECT_EQ(options.size(), (size_t)1); 489 EXPECT_EQ(options.size(), (size_t)1);
506 EXPECT_EQ(options.at(0), "Test"); 490 EXPECT_EQ(options.at(0), "Test");
507 491
508 - app.reset();  
509 args = {"--option=Test", "param1", "param2"}; 492 args = {"--option=Test", "param1", "param2"};
510 run(); 493 run();
511 494
@@ -520,25 +503,22 @@ TEST_F(TApp, RequiredOptsUnlimited) { @@ -520,25 +503,22 @@ TEST_F(TApp, RequiredOptsUnlimited) {
520 503
521 args = {"--str"}; 504 args = {"--str"};
522 EXPECT_THROW(run(), CLI::ArgumentMismatch); 505 EXPECT_THROW(run(), CLI::ArgumentMismatch);
  506 + app.clear();
523 507
524 - app.reset();  
525 args = {"--str", "one", "--str", "two"}; 508 args = {"--str", "one", "--str", "two"};
526 run(); 509 run();
527 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"})); 510 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"}));
528 511
529 - app.reset();  
530 args = {"--str", "one", "two"}; 512 args = {"--str", "one", "two"};
531 run(); 513 run();
532 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"})); 514 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"}));
533 515
534 // It's better to feed a hungry option than to feed allow_extras 516 // It's better to feed a hungry option than to feed allow_extras
535 - app.reset();  
536 app.allow_extras(); 517 app.allow_extras();
537 run(); 518 run();
538 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"})); 519 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"}));
539 EXPECT_EQ(app.remaining(), std::vector<std::string>({})); 520 EXPECT_EQ(app.remaining(), std::vector<std::string>({}));
540 521
541 - app.reset();  
542 app.allow_extras(false); 522 app.allow_extras(false);
543 std::vector<std::string> remain; 523 std::vector<std::string> remain;
544 app.add_option("positional", remain); 524 app.add_option("positional", remain);
@@ -546,14 +526,12 @@ TEST_F(TApp, RequiredOptsUnlimited) { @@ -546,14 +526,12 @@ TEST_F(TApp, RequiredOptsUnlimited) {
546 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"})); 526 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"}));
547 EXPECT_EQ(remain, std::vector<std::string>()); 527 EXPECT_EQ(remain, std::vector<std::string>());
548 528
549 - app.reset();  
550 args = {"--str", "one", "--", "two"}; 529 args = {"--str", "one", "--", "two"};
551 530
552 run(); 531 run();
553 EXPECT_EQ(strs, std::vector<std::string>({"one"})); 532 EXPECT_EQ(strs, std::vector<std::string>({"one"}));
554 EXPECT_EQ(remain, std::vector<std::string>({"two"})); 533 EXPECT_EQ(remain, std::vector<std::string>({"two"}));
555 534
556 - app.reset();  
557 args = {"one", "--str", "two"}; 535 args = {"one", "--str", "two"};
558 536
559 run(); 537 run();
@@ -568,25 +546,22 @@ TEST_F(TApp, RequiredOptsUnlimitedShort) { @@ -568,25 +546,22 @@ TEST_F(TApp, RequiredOptsUnlimitedShort) {
568 546
569 args = {"-s"}; 547 args = {"-s"};
570 EXPECT_THROW(run(), CLI::ArgumentMismatch); 548 EXPECT_THROW(run(), CLI::ArgumentMismatch);
  549 + app.clear();
571 550
572 - app.reset();  
573 args = {"-s", "one", "-s", "two"}; 551 args = {"-s", "one", "-s", "two"};
574 run(); 552 run();
575 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"})); 553 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"}));
576 554
577 - app.reset();  
578 args = {"-s", "one", "two"}; 555 args = {"-s", "one", "two"};
579 run(); 556 run();
580 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"})); 557 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"}));
581 558
582 // It's better to feed a hungry option than to feed allow_extras 559 // It's better to feed a hungry option than to feed allow_extras
583 - app.reset();  
584 app.allow_extras(); 560 app.allow_extras();
585 run(); 561 run();
586 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"})); 562 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"}));
587 EXPECT_EQ(app.remaining(), std::vector<std::string>({})); 563 EXPECT_EQ(app.remaining(), std::vector<std::string>({}));
588 564
589 - app.reset();  
590 app.allow_extras(false); 565 app.allow_extras(false);
591 std::vector<std::string> remain; 566 std::vector<std::string> remain;
592 app.add_option("positional", remain); 567 app.add_option("positional", remain);
@@ -594,14 +569,12 @@ TEST_F(TApp, RequiredOptsUnlimitedShort) { @@ -594,14 +569,12 @@ TEST_F(TApp, RequiredOptsUnlimitedShort) {
594 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"})); 569 EXPECT_EQ(strs, std::vector<std::string>({"one", "two"}));
595 EXPECT_EQ(remain, std::vector<std::string>()); 570 EXPECT_EQ(remain, std::vector<std::string>());
596 571
597 - app.reset();  
598 args = {"-s", "one", "--", "two"}; 572 args = {"-s", "one", "--", "two"};
599 573
600 run(); 574 run();
601 EXPECT_EQ(strs, std::vector<std::string>({"one"})); 575 EXPECT_EQ(strs, std::vector<std::string>({"one"}));
602 EXPECT_EQ(remain, std::vector<std::string>({"two"})); 576 EXPECT_EQ(remain, std::vector<std::string>({"two"}));
603 577
604 - app.reset();  
605 args = {"one", "-s", "two"}; 578 args = {"one", "-s", "two"};
606 579
607 run(); 580 run();
@@ -635,7 +608,6 @@ TEST_F(TApp, RequireOptPriority) { @@ -635,7 +608,6 @@ TEST_F(TApp, RequireOptPriority) {
635 EXPECT_EQ(strs, std::vector<std::string>({"one"})); 608 EXPECT_EQ(strs, std::vector<std::string>({"one"}));
636 EXPECT_EQ(remain, std::vector<std::string>({"two", "three"})); 609 EXPECT_EQ(remain, std::vector<std::string>({"two", "three"}));
637 610
638 - app.reset();  
639 args = {"two", "three", "--str", "one", "four"}; 611 args = {"two", "three", "--str", "one", "four"};
640 run(); 612 run();
641 613
@@ -656,7 +628,6 @@ TEST_F(TApp, RequireOptPriorityShort) { @@ -656,7 +628,6 @@ TEST_F(TApp, RequireOptPriorityShort) {
656 EXPECT_EQ(strs, std::vector<std::string>({"one"})); 628 EXPECT_EQ(strs, std::vector<std::string>({"one"}));
657 EXPECT_EQ(remain, std::vector<std::string>({"two", "three"})); 629 EXPECT_EQ(remain, std::vector<std::string>({"two", "three"}));
658 630
659 - app.reset();  
660 args = {"two", "three", "-s", "one", "four"}; 631 args = {"two", "three", "-s", "one", "four"};
661 run(); 632 run();
662 633
@@ -689,17 +660,16 @@ TEST_F(TApp, RequiredFlags) { @@ -689,17 +660,16 @@ TEST_F(TApp, RequiredFlags) {
689 app.add_flag("-b")->mandatory(); // Alternate term 660 app.add_flag("-b")->mandatory(); // Alternate term
690 661
691 EXPECT_THROW(run(), CLI::RequiredError); 662 EXPECT_THROW(run(), CLI::RequiredError);
692 -  
693 - app.reset(); 663 + app.clear();
694 664
695 args = {"-a"}; 665 args = {"-a"};
696 EXPECT_THROW(run(), CLI::RequiredError); 666 EXPECT_THROW(run(), CLI::RequiredError);
  667 + app.clear();
697 668
698 - app.reset();  
699 args = {"-b"}; 669 args = {"-b"};
700 EXPECT_THROW(run(), CLI::RequiredError); 670 EXPECT_THROW(run(), CLI::RequiredError);
  671 + app.clear();
701 672
702 - app.reset();  
703 args = {"-a", "-b"}; 673 args = {"-a", "-b"};
704 run(); 674 run();
705 } 675 }
@@ -715,12 +685,10 @@ TEST_F(TApp, CallbackFlags) { @@ -715,12 +685,10 @@ TEST_F(TApp, CallbackFlags) {
715 run(); 685 run();
716 EXPECT_EQ(value, (size_t)0); 686 EXPECT_EQ(value, (size_t)0);
717 687
718 - app.reset();  
719 args = {"-v"}; 688 args = {"-v"};
720 run(); 689 run();
721 EXPECT_EQ(value, (size_t)1); 690 EXPECT_EQ(value, (size_t)1);
722 691
723 - app.reset();  
724 args = {"-vv"}; 692 args = {"-vv"};
725 run(); 693 run();
726 EXPECT_EQ(value, (size_t)2); 694 EXPECT_EQ(value, (size_t)2);
@@ -740,12 +708,10 @@ TEST_F(TApp, CallbackFlagsAuto) { @@ -740,12 +708,10 @@ TEST_F(TApp, CallbackFlagsAuto) {
740 run(); 708 run();
741 EXPECT_EQ(value, (size_t)0); 709 EXPECT_EQ(value, (size_t)0);
742 710
743 - app.reset();  
744 args = {"-v"}; 711 args = {"-v"};
745 run(); 712 run();
746 EXPECT_EQ(value, (size_t)1); 713 EXPECT_EQ(value, (size_t)1);
747 714
748 - app.reset();  
749 args = {"-vv"}; 715 args = {"-vv"};
750 run(); 716 run();
751 EXPECT_EQ(value, (size_t)2); 717 EXPECT_EQ(value, (size_t)2);
@@ -782,8 +748,6 @@ TEST_F(TApp, ForcedPositional) { @@ -782,8 +748,6 @@ TEST_F(TApp, ForcedPositional) {
782 EXPECT_TRUE(one->count()); 748 EXPECT_TRUE(one->count());
783 EXPECT_EQ(answers1, posit); 749 EXPECT_EQ(answers1, posit);
784 750
785 - app.reset();  
786 -  
787 args = {"--", "--one", "two", "three"}; 751 args = {"--", "--one", "two", "three"};
788 std::vector<std::string> answers2 = {"--one", "two", "three"}; 752 std::vector<std::string> answers2 = {"--one", "two", "three"};
789 run(); 753 run();
@@ -818,8 +782,6 @@ TEST_F(TApp, BigPositional) { @@ -818,8 +782,6 @@ TEST_F(TApp, BigPositional) {
818 run(); 782 run();
819 EXPECT_EQ(args, vec); 783 EXPECT_EQ(args, vec);
820 784
821 - app.reset();  
822 -  
823 args = {"one", "two"}; 785 args = {"one", "two"};
824 run(); 786 run();
825 787
@@ -840,7 +802,7 @@ TEST_F(TApp, Reset) { @@ -840,7 +802,7 @@ TEST_F(TApp, Reset) {
840 EXPECT_EQ((size_t)1, app.count("-d")); 802 EXPECT_EQ((size_t)1, app.count("-d"));
841 EXPECT_DOUBLE_EQ(1.2, doub); 803 EXPECT_DOUBLE_EQ(1.2, doub);
842 804
843 - app.reset(); 805 + app.clear();
844 806
845 EXPECT_EQ((size_t)0, app.count("--simple")); 807 EXPECT_EQ((size_t)0, app.count("--simple"));
846 EXPECT_EQ((size_t)0, app.count("-d")); 808 EXPECT_EQ((size_t)0, app.count("-d"));
@@ -866,7 +828,7 @@ TEST_F(TApp, RemoveOption) { @@ -866,7 +828,7 @@ TEST_F(TApp, RemoveOption) {
866 828
867 TEST_F(TApp, FileNotExists) { 829 TEST_F(TApp, FileNotExists) {
868 std::string myfile{"TestNonFileNotUsed.txt"}; 830 std::string myfile{"TestNonFileNotUsed.txt"};
869 - EXPECT_NO_THROW(CLI::NonexistentPath(myfile)); 831 + ASSERT_NO_THROW(CLI::NonexistentPath(myfile));
870 832
871 std::string filename; 833 std::string filename;
872 app.add_option("--file", filename)->check(CLI::NonexistentPath); 834 app.add_option("--file", filename)->check(CLI::NonexistentPath);
@@ -875,8 +837,6 @@ TEST_F(TApp, FileNotExists) { @@ -875,8 +837,6 @@ TEST_F(TApp, FileNotExists) {
875 run(); 837 run();
876 EXPECT_EQ(myfile, filename); 838 EXPECT_EQ(myfile, filename);
877 839
878 - app.reset();  
879 -  
880 bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file 840 bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file
881 EXPECT_TRUE(ok); 841 EXPECT_TRUE(ok);
882 EXPECT_THROW(run(), CLI::ValidationError); 842 EXPECT_THROW(run(), CLI::ValidationError);
@@ -894,8 +854,7 @@ TEST_F(TApp, FileExists) { @@ -894,8 +854,7 @@ TEST_F(TApp, FileExists) {
894 args = {"--file", myfile}; 854 args = {"--file", myfile};
895 855
896 EXPECT_THROW(run(), CLI::ValidationError); 856 EXPECT_THROW(run(), CLI::ValidationError);
897 -  
898 - app.reset(); 857 + app.clear();
899 858
900 bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file 859 bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file
901 EXPECT_TRUE(ok); 860 EXPECT_TRUE(ok);
@@ -916,8 +875,6 @@ TEST_F(TApp, InSet) { @@ -916,8 +875,6 @@ TEST_F(TApp, InSet) {
916 run(); 875 run();
917 EXPECT_EQ("two", choice); 876 EXPECT_EQ("two", choice);
918 877
919 - app.reset();  
920 -  
921 args = {"--quick", "four"}; 878 args = {"--quick", "four"};
922 EXPECT_THROW(run(), CLI::ConversionError); 879 EXPECT_THROW(run(), CLI::ConversionError);
923 } 880 }
@@ -929,15 +886,12 @@ TEST_F(TApp, InSetWithDefault) { @@ -929,15 +886,12 @@ TEST_F(TApp, InSetWithDefault) {
929 886
930 run(); 887 run();
931 EXPECT_EQ("one", choice); 888 EXPECT_EQ("one", choice);
932 - app.reset();  
933 889
934 args = {"--quick", "two"}; 890 args = {"--quick", "two"};
935 891
936 run(); 892 run();
937 EXPECT_EQ("two", choice); 893 EXPECT_EQ("two", choice);
938 894
939 - app.reset();  
940 -  
941 args = {"--quick", "four"}; 895 args = {"--quick", "four"};
942 EXPECT_THROW(run(), CLI::ConversionError); 896 EXPECT_THROW(run(), CLI::ConversionError);
943 } 897 }
@@ -949,15 +903,12 @@ TEST_F(TApp, InCaselessSetWithDefault) { @@ -949,15 +903,12 @@ TEST_F(TApp, InCaselessSetWithDefault) {
949 903
950 run(); 904 run();
951 EXPECT_EQ("one", choice); 905 EXPECT_EQ("one", choice);
952 - app.reset();  
953 906
954 args = {"--quick", "tWo"}; 907 args = {"--quick", "tWo"};
955 908
956 run(); 909 run();
957 EXPECT_EQ("two", choice); 910 EXPECT_EQ("two", choice);
958 911
959 - app.reset();  
960 -  
961 args = {"--quick", "four"}; 912 args = {"--quick", "four"};
962 EXPECT_THROW(run(), CLI::ConversionError); 913 EXPECT_THROW(run(), CLI::ConversionError);
963 } 914 }
@@ -972,8 +923,6 @@ TEST_F(TApp, InIntSet) { @@ -972,8 +923,6 @@ TEST_F(TApp, InIntSet) {
972 run(); 923 run();
973 EXPECT_EQ(2, choice); 924 EXPECT_EQ(2, choice);
974 925
975 - app.reset();  
976 -  
977 args = {"--quick", "4"}; 926 args = {"--quick", "4"};
978 EXPECT_THROW(run(), CLI::ConversionError); 927 EXPECT_THROW(run(), CLI::ConversionError);
979 } 928 }
@@ -985,8 +934,7 @@ TEST_F(TApp, FailSet) { @@ -985,8 +934,7 @@ TEST_F(TApp, FailSet) {
985 934
986 args = {"--quick", "3", "--quick=2"}; 935 args = {"--quick", "3", "--quick=2"};
987 EXPECT_THROW(run(), CLI::ArgumentMismatch); 936 EXPECT_THROW(run(), CLI::ArgumentMismatch);
988 -  
989 - app.reset(); 937 + app.clear();
990 938
991 args = {"--quick=hello"}; 939 args = {"--quick=hello"};
992 EXPECT_THROW(run(), CLI::ConversionError); 940 EXPECT_THROW(run(), CLI::ConversionError);
@@ -1001,8 +949,8 @@ TEST_F(TApp, FailLValueSet) { @@ -1001,8 +949,8 @@ TEST_F(TApp, FailLValueSet) {
1001 949
1002 args = {"--quick=hello"}; 950 args = {"--quick=hello"};
1003 EXPECT_THROW(run(), CLI::ConversionError); 951 EXPECT_THROW(run(), CLI::ConversionError);
  952 + app.clear();
1004 953
1005 - app.reset();  
1006 args = {"--slow=hello"}; 954 args = {"--slow=hello"};
1007 EXPECT_THROW(run(), CLI::ConversionError); 955 EXPECT_THROW(run(), CLI::ConversionError);
1008 } 956 }
@@ -1016,21 +964,18 @@ TEST_F(TApp, InSetIgnoreCase) { @@ -1016,21 +964,18 @@ TEST_F(TApp, InSetIgnoreCase) {
1016 run(); 964 run();
1017 EXPECT_EQ("one", choice); 965 EXPECT_EQ("one", choice);
1018 966
1019 - app.reset();  
1020 args = {"--quick", "two"}; 967 args = {"--quick", "two"};
1021 run(); 968 run();
1022 EXPECT_EQ("Two", choice); // Keeps caps from set 969 EXPECT_EQ("Two", choice); // Keeps caps from set
1023 970
1024 - app.reset();  
1025 args = {"--quick", "ThrEE"}; 971 args = {"--quick", "ThrEE"};
1026 run(); 972 run();
1027 EXPECT_EQ("THREE", choice); // Keeps caps from set 973 EXPECT_EQ("THREE", choice); // Keeps caps from set
1028 974
1029 - app.reset();  
1030 args = {"--quick", "four"}; 975 args = {"--quick", "four"};
1031 EXPECT_THROW(run(), CLI::ConversionError); 976 EXPECT_THROW(run(), CLI::ConversionError);
  977 + app.clear();
1032 978
1033 - app.reset();  
1034 args = {"--quick=one", "--quick=two"}; 979 args = {"--quick=one", "--quick=two"};
1035 EXPECT_THROW(run(), CLI::ArgumentMismatch); 980 EXPECT_THROW(run(), CLI::ArgumentMismatch);
1036 } 981 }
@@ -1073,7 +1018,6 @@ TEST_F(TApp, VectorUnlimString) { @@ -1073,7 +1018,6 @@ TEST_F(TApp, VectorUnlimString) {
1073 EXPECT_EQ((size_t)3, app.count("--string")); 1018 EXPECT_EQ((size_t)3, app.count("--string"));
1074 EXPECT_EQ(answer, strvec); 1019 EXPECT_EQ(answer, strvec);
1075 1020
1076 - app.reset();  
1077 args = {"-s", "mystring", "mystring2", "mystring3"}; 1021 args = {"-s", "mystring", "mystring2", "mystring3"};
1078 run(); 1022 run();
1079 EXPECT_EQ((size_t)3, app.count("--string")); 1023 EXPECT_EQ((size_t)3, app.count("--string"));
@@ -1092,11 +1036,10 @@ TEST_F(TApp, VectorFancyOpts) { @@ -1092,11 +1036,10 @@ TEST_F(TApp, VectorFancyOpts) {
1092 EXPECT_EQ((size_t)3, app.count("--string")); 1036 EXPECT_EQ((size_t)3, app.count("--string"));
1093 EXPECT_EQ(answer, strvec); 1037 EXPECT_EQ(answer, strvec);
1094 1038
1095 - app.reset();  
1096 args = {"one", "two"}; 1039 args = {"one", "two"};
1097 EXPECT_THROW(run(), CLI::RequiredError); 1040 EXPECT_THROW(run(), CLI::RequiredError);
  1041 + app.clear();
1098 1042
1099 - app.reset();  
1100 EXPECT_THROW(run(), CLI::ParseError); 1043 EXPECT_THROW(run(), CLI::ParseError);
1101 } 1044 }
1102 1045
@@ -1122,15 +1065,12 @@ TEST_F(TApp, NeedsFlags) { @@ -1122,15 +1065,12 @@ TEST_F(TApp, NeedsFlags) {
1122 1065
1123 run(); 1066 run();
1124 1067
1125 - app.reset();  
1126 args = {"-s"}; 1068 args = {"-s"};
1127 run(); 1069 run();
1128 1070
1129 - app.reset();  
1130 args = {"-s", "--both"}; 1071 args = {"-s", "--both"};
1131 run(); 1072 run();
1132 1073
1133 - app.reset();  
1134 args = {"--both"}; 1074 args = {"--both"};
1135 EXPECT_THROW(run(), CLI::RequiresError); 1075 EXPECT_THROW(run(), CLI::RequiresError);
1136 } 1076 }
@@ -1141,19 +1081,16 @@ TEST_F(TApp, ExcludesFlags) { @@ -1141,19 +1081,16 @@ TEST_F(TApp, ExcludesFlags) {
1141 1081
1142 run(); 1082 run();
1143 1083
1144 - app.reset();  
1145 args = {"-s"}; 1084 args = {"-s"};
1146 run(); 1085 run();
1147 1086
1148 - app.reset();  
1149 args = {"--nostr"}; 1087 args = {"--nostr"};
1150 run(); 1088 run();
1151 1089
1152 - app.reset();  
1153 args = {"--nostr", "-s"}; 1090 args = {"--nostr", "-s"};
1154 EXPECT_THROW(run(), CLI::ExcludesError); 1091 EXPECT_THROW(run(), CLI::ExcludesError);
  1092 + app.clear();
1155 1093
1156 - app.reset();  
1157 args = {"--string", "--nostr"}; 1094 args = {"--string", "--nostr"};
1158 EXPECT_THROW(run(), CLI::ExcludesError); 1095 EXPECT_THROW(run(), CLI::ExcludesError);
1159 } 1096 }
@@ -1166,19 +1103,16 @@ TEST_F(TApp, ExcludesMixedFlags) { @@ -1166,19 +1103,16 @@ TEST_F(TApp, ExcludesMixedFlags) {
1166 1103
1167 run(); 1104 run();
1168 1105
1169 - app.reset();  
1170 args = {"--no"}; 1106 args = {"--no"};
1171 run(); 1107 run();
1172 1108
1173 - app.reset();  
1174 args = {"--opt2"}; 1109 args = {"--opt2"};
1175 run(); 1110 run();
1176 1111
1177 - app.reset();  
1178 args = {"--no", "--opt1"}; 1112 args = {"--no", "--opt1"};
1179 EXPECT_THROW(run(), CLI::ExcludesError); 1113 EXPECT_THROW(run(), CLI::ExcludesError);
  1114 + app.clear();
1180 1115
1181 - app.reset();  
1182 args = {"--no", "--opt2"}; 1116 args = {"--no", "--opt2"};
1183 EXPECT_THROW(run(), CLI::ExcludesError); 1117 EXPECT_THROW(run(), CLI::ExcludesError);
1184 } 1118 }
@@ -1191,27 +1125,24 @@ TEST_F(TApp, NeedsMultiFlags) { @@ -1191,27 +1125,24 @@ TEST_F(TApp, NeedsMultiFlags) {
1191 1125
1192 run(); 1126 run();
1193 1127
1194 - app.reset();  
1195 args = {"--opt1"}; 1128 args = {"--opt1"};
1196 run(); 1129 run();
1197 1130
1198 - app.reset();  
1199 args = {"--opt2"}; 1131 args = {"--opt2"};
1200 run(); 1132 run();
1201 1133
1202 - app.reset();  
1203 args = {"--optall"}; 1134 args = {"--optall"};
1204 EXPECT_THROW(run(), CLI::RequiresError); 1135 EXPECT_THROW(run(), CLI::RequiresError);
  1136 + app.clear();
1205 1137
1206 - app.reset();  
1207 args = {"--optall", "--opt1"}; 1138 args = {"--optall", "--opt1"};
1208 EXPECT_THROW(run(), CLI::RequiresError); 1139 EXPECT_THROW(run(), CLI::RequiresError);
  1140 + app.clear();
1209 1141
1210 - app.reset();  
1211 args = {"--optall", "--opt2", "--opt1"}; 1142 args = {"--optall", "--opt2", "--opt1"};
1212 EXPECT_THROW(run(), CLI::RequiresError); 1143 EXPECT_THROW(run(), CLI::RequiresError);
  1144 + app.clear();
1213 1145
1214 - app.reset();  
1215 args = {"--optall", "--opt1", "--opt2", "--opt3"}; 1146 args = {"--optall", "--opt1", "--opt2", "--opt3"};
1216 run(); 1147 run();
1217 } 1148 }
@@ -1224,27 +1155,24 @@ TEST_F(TApp, NeedsMixedFlags) { @@ -1224,27 +1155,24 @@ TEST_F(TApp, NeedsMixedFlags) {
1224 1155
1225 run(); 1156 run();
1226 1157
1227 - app.reset();  
1228 args = {"--opt1"}; 1158 args = {"--opt1"};
1229 run(); 1159 run();
1230 1160
1231 - app.reset();  
1232 args = {"--opt2"}; 1161 args = {"--opt2"};
1233 run(); 1162 run();
1234 1163
1235 - app.reset();  
1236 args = {"--optall"}; 1164 args = {"--optall"};
1237 EXPECT_THROW(run(), CLI::RequiresError); 1165 EXPECT_THROW(run(), CLI::RequiresError);
  1166 + app.clear();
1238 1167
1239 - app.reset();  
1240 args = {"--optall", "--opt1"}; 1168 args = {"--optall", "--opt1"};
1241 EXPECT_THROW(run(), CLI::RequiresError); 1169 EXPECT_THROW(run(), CLI::RequiresError);
  1170 + app.clear();
1242 1171
1243 - app.reset();  
1244 args = {"--optall", "--opt2", "--opt1"}; 1172 args = {"--optall", "--opt2", "--opt1"};
1245 EXPECT_THROW(run(), CLI::RequiresError); 1173 EXPECT_THROW(run(), CLI::RequiresError);
  1174 + app.clear();
1246 1175
1247 - app.reset();  
1248 args = {"--optall", "--opt1", "--opt2", "--opt3"}; 1176 args = {"--optall", "--opt1", "--opt2", "--opt3"};
1249 run(); 1177 run();
1250 } 1178 }
@@ -1256,31 +1184,28 @@ TEST_F(TApp, NeedsChainedFlags) { @@ -1256,31 +1184,28 @@ TEST_F(TApp, NeedsChainedFlags) {
1256 1184
1257 run(); 1185 run();
1258 1186
1259 - app.reset();  
1260 args = {"--opt1"}; 1187 args = {"--opt1"};
1261 run(); 1188 run();
1262 1189
1263 - app.reset();  
1264 args = {"--opt2"}; 1190 args = {"--opt2"};
1265 EXPECT_THROW(run(), CLI::RequiresError); 1191 EXPECT_THROW(run(), CLI::RequiresError);
  1192 + app.clear();
1266 1193
1267 - app.reset();  
1268 args = {"--opt3"}; 1194 args = {"--opt3"};
1269 EXPECT_THROW(run(), CLI::RequiresError); 1195 EXPECT_THROW(run(), CLI::RequiresError);
  1196 + app.clear();
1270 1197
1271 - app.reset();  
1272 args = {"--opt3", "--opt2"}; 1198 args = {"--opt3", "--opt2"};
1273 EXPECT_THROW(run(), CLI::RequiresError); 1199 EXPECT_THROW(run(), CLI::RequiresError);
  1200 + app.clear();
1274 1201
1275 - app.reset();  
1276 args = {"--opt3", "--opt1"}; 1202 args = {"--opt3", "--opt1"};
1277 EXPECT_THROW(run(), CLI::RequiresError); 1203 EXPECT_THROW(run(), CLI::RequiresError);
  1204 + app.clear();
1278 1205
1279 - app.reset();  
1280 args = {"--opt2", "--opt1"}; 1206 args = {"--opt2", "--opt1"};
1281 run(); 1207 run();
1282 1208
1283 - app.reset();  
1284 args = {"--opt1", "--opt2", "--opt3"}; 1209 args = {"--opt1", "--opt2", "--opt3"};
1285 run(); 1210 run();
1286 } 1211 }
@@ -1297,11 +1222,9 @@ TEST_F(TApp, Env) { @@ -1297,11 +1222,9 @@ TEST_F(TApp, Env) {
1297 EXPECT_EQ(2, val); 1222 EXPECT_EQ(2, val);
1298 EXPECT_EQ((size_t)1, vopt->count()); 1223 EXPECT_EQ((size_t)1, vopt->count());
1299 1224
1300 - app.reset();  
1301 vopt->required(); 1225 vopt->required();
1302 run(); 1226 run();
1303 1227
1304 - app.reset();  
1305 unset_env("CLI11_TEST_ENV_TMP"); 1228 unset_env("CLI11_TEST_ENV_TMP");
1306 EXPECT_THROW(run(), CLI::RequiredError); 1229 EXPECT_THROW(run(), CLI::RequiredError);
1307 } 1230 }
@@ -1312,20 +1235,18 @@ TEST_F(TApp, RangeInt) { @@ -1312,20 +1235,18 @@ TEST_F(TApp, RangeInt) {
1312 1235
1313 args = {"--one=1"}; 1236 args = {"--one=1"};
1314 EXPECT_THROW(run(), CLI::ValidationError); 1237 EXPECT_THROW(run(), CLI::ValidationError);
  1238 + app.clear();
1315 1239
1316 - app.reset();  
1317 args = {"--one=7"}; 1240 args = {"--one=7"};
1318 EXPECT_THROW(run(), CLI::ValidationError); 1241 EXPECT_THROW(run(), CLI::ValidationError);
  1242 + app.clear();
1319 1243
1320 - app.reset();  
1321 args = {"--one=3"}; 1244 args = {"--one=3"};
1322 run(); 1245 run();
1323 1246
1324 - app.reset();  
1325 args = {"--one=5"}; 1247 args = {"--one=5"};
1326 run(); 1248 run();
1327 1249
1328 - app.reset();  
1329 args = {"--one=6"}; 1250 args = {"--one=6"};
1330 run(); 1251 run();
1331 } 1252 }
@@ -1338,20 +1259,18 @@ TEST_F(TApp, RangeDouble) { @@ -1338,20 +1259,18 @@ TEST_F(TApp, RangeDouble) {
1338 1259
1339 args = {"--one=1"}; 1260 args = {"--one=1"};
1340 EXPECT_THROW(run(), CLI::ValidationError); 1261 EXPECT_THROW(run(), CLI::ValidationError);
  1262 + app.clear();
1341 1263
1342 - app.reset();  
1343 args = {"--one=7"}; 1264 args = {"--one=7"};
1344 EXPECT_THROW(run(), CLI::ValidationError); 1265 EXPECT_THROW(run(), CLI::ValidationError);
  1266 + app.clear();
1345 1267
1346 - app.reset();  
1347 args = {"--one=3"}; 1268 args = {"--one=3"};
1348 run(); 1269 run();
1349 1270
1350 - app.reset();  
1351 args = {"--one=5"}; 1271 args = {"--one=5"};
1352 run(); 1272 run();
1353 1273
1354 - app.reset();  
1355 args = {"--one=6"}; 1274 args = {"--one=6"};
1356 run(); 1275 run();
1357 } 1276 }
@@ -1367,7 +1286,7 @@ TEST_F(TApp, AllowExtras) { @@ -1367,7 +1286,7 @@ TEST_F(TApp, AllowExtras) {
1367 1286
1368 args = {"-x", "-f"}; 1287 args = {"-x", "-f"};
1369 1288
1370 - EXPECT_NO_THROW(run()); 1289 + ASSERT_NO_THROW(run());
1371 EXPECT_TRUE(val); 1290 EXPECT_TRUE(val);
1372 EXPECT_EQ(app.remaining(), std::vector<std::string>({"-x"})); 1291 EXPECT_EQ(app.remaining(), std::vector<std::string>({"-x"}));
1373 } 1292 }
@@ -1377,9 +1296,8 @@ TEST_F(TApp, AllowExtrasOrder) { @@ -1377,9 +1296,8 @@ TEST_F(TApp, AllowExtrasOrder) {
1377 app.allow_extras(); 1296 app.allow_extras();
1378 1297
1379 args = {"-x", "-f"}; 1298 args = {"-x", "-f"};
1380 - EXPECT_NO_THROW(run()); 1299 + ASSERT_NO_THROW(run());
1381 EXPECT_EQ(app.remaining(), std::vector<std::string>({"-x", "-f"})); 1300 EXPECT_EQ(app.remaining(), std::vector<std::string>({"-x", "-f"}));
1382 - app.reset();  
1383 1301
1384 std::vector<std::string> left_over = app.remaining(); 1302 std::vector<std::string> left_over = app.remaining();
1385 app.parse(left_over); 1303 app.parse(left_over);
@@ -1462,14 +1380,12 @@ TEST_F(TApp, ThrowingTransform) { @@ -1462,14 +1380,12 @@ TEST_F(TApp, ThrowingTransform) {
1462 auto m = app.add_option("-m,--mess", val); 1380 auto m = app.add_option("-m,--mess", val);
1463 m->transform([](std::string) -> std::string { throw CLI::ValidationError("My Message"); }); 1381 m->transform([](std::string) -> std::string { throw CLI::ValidationError("My Message"); });
1464 1382
1465 - EXPECT_NO_THROW(run());  
1466 - app.reset(); 1383 + ASSERT_NO_THROW(run());
1467 1384
1468 args = {"-mone"}; 1385 args = {"-mone"};
1469 1386
1470 ASSERT_THROW(run(), CLI::ValidationError); 1387 ASSERT_THROW(run(), CLI::ValidationError);
1471 -  
1472 - app.reset(); 1388 + app.clear();
1473 1389
1474 try { 1390 try {
1475 run(); 1391 run();
@@ -1533,17 +1449,15 @@ TEST_F(TApp, AddRemoveSetItems) { @@ -1533,17 +1449,15 @@ TEST_F(TApp, AddRemoveSetItems) {
1533 items.erase("TYPE1"); 1449 items.erase("TYPE1");
1534 items.erase("TYPE2"); 1450 items.erase("TYPE2");
1535 1451
1536 - app.reset();  
1537 args = {"--type1", "TYPE6", "--type2", "TYPE7"}; 1452 args = {"--type1", "TYPE6", "--type2", "TYPE7"};
1538 run(); 1453 run();
1539 EXPECT_EQ(type1, "TYPE6"); 1454 EXPECT_EQ(type1, "TYPE6");
1540 EXPECT_EQ(type2, "TYPE7"); 1455 EXPECT_EQ(type2, "TYPE7");
1541 1456
1542 - app.reset();  
1543 args = {"--type1", "TYPE1"}; 1457 args = {"--type1", "TYPE1"};
1544 EXPECT_THROW(run(), CLI::ConversionError); 1458 EXPECT_THROW(run(), CLI::ConversionError);
  1459 + app.clear();
1545 1460
1546 - app.reset();  
1547 args = {"--type2", "TYPE2"}; 1461 args = {"--type2", "TYPE2"};
1548 EXPECT_THROW(run(), CLI::ConversionError); 1462 EXPECT_THROW(run(), CLI::ConversionError);
1549 } 1463 }
@@ -1567,17 +1481,15 @@ TEST_F(TApp, AddRemoveSetItemsNoCase) { @@ -1567,17 +1481,15 @@ TEST_F(TApp, AddRemoveSetItemsNoCase) {
1567 items.erase("TYPE1"); 1481 items.erase("TYPE1");
1568 items.erase("TYPE2"); 1482 items.erase("TYPE2");
1569 1483
1570 - app.reset();  
1571 args = {"--type1", "TyPE6", "--type2", "tYPE7"}; 1484 args = {"--type1", "TyPE6", "--type2", "tYPE7"};
1572 run(); 1485 run();
1573 EXPECT_EQ(type1, "TYPE6"); 1486 EXPECT_EQ(type1, "TYPE6");
1574 EXPECT_EQ(type2, "TYPE7"); 1487 EXPECT_EQ(type2, "TYPE7");
1575 1488
1576 - app.reset();  
1577 args = {"--type1", "TYPe1"}; 1489 args = {"--type1", "TYPe1"};
1578 EXPECT_THROW(run(), CLI::ConversionError); 1490 EXPECT_THROW(run(), CLI::ConversionError);
  1491 + app.clear();
1579 1492
1580 - app.reset();  
1581 args = {"--type2", "TYpE2"}; 1493 args = {"--type2", "TYpE2"};
1582 EXPECT_THROW(run(), CLI::ConversionError); 1494 EXPECT_THROW(run(), CLI::ConversionError);
1583 } 1495 }
@@ -1588,10 +1500,9 @@ TEST_F(TApp, RepeatingMultiArgumentOptions) { @@ -1588,10 +1500,9 @@ TEST_F(TApp, RepeatingMultiArgumentOptions) {
1588 app.add_option("--entry", entries, "set a key and value")->type_name("KEY VALUE")->type_size(-2); 1500 app.add_option("--entry", entries, "set a key and value")->type_name("KEY VALUE")->type_size(-2);
1589 1501
1590 args = {"--entry", "key1", "value1", "--entry", "key2", "value2"}; 1502 args = {"--entry", "key1", "value1", "--entry", "key2", "value2"};
1591 - EXPECT_NO_THROW(run()); 1503 + ASSERT_NO_THROW(run());
1592 EXPECT_EQ(entries, std::vector<std::string>({"key1", "value1", "key2", "value2"})); 1504 EXPECT_EQ(entries, std::vector<std::string>({"key1", "value1", "key2", "value2"}));
1593 1505
1594 - app.reset();  
1595 args.pop_back(); 1506 args.pop_back();
1596 ASSERT_THROW(run(), CLI::ArgumentMismatch); 1507 ASSERT_THROW(run(), CLI::ArgumentMismatch);
1597 } 1508 }
tests/HelpTest.cpp
@@ -326,14 +326,14 @@ TEST(THelp, OnlyOneAllHelp) { @@ -326,14 +326,14 @@ TEST(THelp, OnlyOneAllHelp) {
326 326
327 std::vector<std::string> input{"--help-all"}; 327 std::vector<std::string> input{"--help-all"};
328 EXPECT_THROW(app.parse(input), CLI::ExtrasError); 328 EXPECT_THROW(app.parse(input), CLI::ExtrasError);
  329 + app.clear();
329 330
330 - app.reset();  
331 std::vector<std::string> input2{"--yelp"}; 331 std::vector<std::string> input2{"--yelp"};
332 EXPECT_THROW(app.parse(input2), CLI::CallForAllHelp); 332 EXPECT_THROW(app.parse(input2), CLI::CallForAllHelp);
  333 + app.clear();
333 334
334 // Remove the flag 335 // Remove the flag
335 app.set_help_all_flag(); 336 app.set_help_all_flag();
336 - app.reset();  
337 std::vector<std::string> input3{"--yelp"}; 337 std::vector<std::string> input3{"--yelp"};
338 EXPECT_THROW(app.parse(input3), CLI::ExtrasError); 338 EXPECT_THROW(app.parse(input3), CLI::ExtrasError);
339 } 339 }
tests/IniTest.cpp
@@ -193,7 +193,6 @@ TEST_F(TApp, IniNotRequired) { @@ -193,7 +193,6 @@ TEST_F(TApp, IniNotRequired) {
193 EXPECT_EQ(99, two); 193 EXPECT_EQ(99, two);
194 EXPECT_EQ(3, three); 194 EXPECT_EQ(3, three);
195 195
196 - app.reset();  
197 one = two = three = 0; 196 one = two = three = 0;
198 args = {"--one=1", "--two=2"}; 197 args = {"--one=1", "--two=2"};
199 198
@@ -238,7 +237,7 @@ TEST_F(TApp, IniGetRemainingOption) { @@ -238,7 +237,7 @@ TEST_F(TApp, IniGetRemainingOption) {
238 237
239 int two = 0; 238 int two = 0;
240 app.add_option("--two", two); 239 app.add_option("--two", two);
241 - EXPECT_NO_THROW(run()); 240 + ASSERT_NO_THROW(run());
242 std::vector<std::string> ExpectedRemaining = {ExtraOption}; 241 std::vector<std::string> ExpectedRemaining = {ExtraOption};
243 EXPECT_EQ(app.remaining(), ExpectedRemaining); 242 EXPECT_EQ(app.remaining(), ExpectedRemaining);
244 } 243 }
@@ -256,7 +255,7 @@ TEST_F(TApp, IniGetNoRemaining) { @@ -256,7 +255,7 @@ TEST_F(TApp, IniGetNoRemaining) {
256 255
257 int two = 0; 256 int two = 0;
258 app.add_option("--two", two); 257 app.add_option("--two", two);
259 - EXPECT_NO_THROW(run()); 258 + ASSERT_NO_THROW(run());
260 EXPECT_EQ(app.remaining().size(), (size_t)0); 259 EXPECT_EQ(app.remaining().size(), (size_t)0);
261 } 260 }
262 261
@@ -291,7 +290,6 @@ TEST_F(TApp, IniNotRequiredNotDefault) { @@ -291,7 +290,6 @@ TEST_F(TApp, IniNotRequiredNotDefault) {
291 EXPECT_EQ(99, two); 290 EXPECT_EQ(99, two);
292 EXPECT_EQ(3, three); 291 EXPECT_EQ(3, three);
293 292
294 - app.reset();  
295 args = {"--config", tmpini2}; 293 args = {"--config", tmpini2};
296 run(); 294 run();
297 295
@@ -360,18 +358,16 @@ TEST_F(TApp, IniRequired) { @@ -360,18 +358,16 @@ TEST_F(TApp, IniRequired) {
360 358
361 run(); 359 run();
362 360
363 - app.reset();  
364 one = two = three = 0; 361 one = two = three = 0;
365 args = {"--one=1", "--two=2"}; 362 args = {"--one=1", "--two=2"};
366 363
367 run(); 364 run();
368 365
369 - app.reset();  
370 args = {}; 366 args = {};
371 367
372 EXPECT_THROW(run(), CLI::RequiredError); 368 EXPECT_THROW(run(), CLI::RequiredError);
  369 + app.clear();
373 370
374 - app.reset();  
375 args = {"--two=2"}; 371 args = {"--two=2"};
376 372
377 EXPECT_THROW(run(), CLI::RequiredError); 373 EXPECT_THROW(run(), CLI::RequiredError);
@@ -458,7 +454,7 @@ TEST_F(TApp, IniConfigurable) { @@ -458,7 +454,7 @@ TEST_F(TApp, IniConfigurable) {
458 out << "val=1" << std::endl; 454 out << "val=1" << std::endl;
459 } 455 }
460 456
461 - EXPECT_NO_THROW(run()); 457 + ASSERT_NO_THROW(run());
462 EXPECT_TRUE(value); 458 EXPECT_TRUE(value);
463 } 459 }
464 460
@@ -538,7 +534,7 @@ TEST_F(TApp, IniFlagNumbers) { @@ -538,7 +534,7 @@ TEST_F(TApp, IniFlagNumbers) {
538 out << "flag=3" << std::endl; 534 out << "flag=3" << std::endl;
539 } 535 }
540 536
541 - EXPECT_NO_THROW(run()); 537 + ASSERT_NO_THROW(run());
542 EXPECT_TRUE(boo); 538 EXPECT_TRUE(boo);
543 } 539 }
544 540
tests/OptionalTest.cpp
@@ -11,13 +11,11 @@ TEST_F(TApp, StdOptionalTest) { @@ -11,13 +11,11 @@ TEST_F(TApp, StdOptionalTest) {
11 run(); 11 run();
12 EXPECT_FALSE(opt); 12 EXPECT_FALSE(opt);
13 13
14 - app.reset();  
15 args = {"-c", "1"}; 14 args = {"-c", "1"};
16 run(); 15 run();
17 EXPECT_TRUE(opt); 16 EXPECT_TRUE(opt);
18 EXPECT_EQ(*opt, 1); 17 EXPECT_EQ(*opt, 1);
19 18
20 - app.reset();  
21 args = {"--count", "3"}; 19 args = {"--count", "3"};
22 run(); 20 run();
23 EXPECT_TRUE(opt); 21 EXPECT_TRUE(opt);
@@ -33,13 +31,11 @@ TEST_F(TApp, ExperimentalOptionalTest) { @@ -33,13 +31,11 @@ TEST_F(TApp, ExperimentalOptionalTest) {
33 run(); 31 run();
34 EXPECT_FALSE(opt); 32 EXPECT_FALSE(opt);
35 33
36 - app.reset();  
37 args = {"-c", "1"}; 34 args = {"-c", "1"};
38 run(); 35 run();
39 EXPECT_TRUE(opt); 36 EXPECT_TRUE(opt);
40 EXPECT_EQ(*opt, 1); 37 EXPECT_EQ(*opt, 1);
41 38
42 - app.reset();  
43 args = {"--count", "3"}; 39 args = {"--count", "3"};
44 run(); 40 run();
45 EXPECT_TRUE(opt); 41 EXPECT_TRUE(opt);
@@ -55,13 +51,11 @@ TEST_F(TApp, BoostOptionalTest) { @@ -55,13 +51,11 @@ TEST_F(TApp, BoostOptionalTest) {
55 run(); 51 run();
56 EXPECT_FALSE(opt); 52 EXPECT_FALSE(opt);
57 53
58 - app.reset();  
59 args = {"-c", "1"}; 54 args = {"-c", "1"};
60 run(); 55 run();
61 EXPECT_TRUE(opt); 56 EXPECT_TRUE(opt);
62 EXPECT_EQ(*opt, 1); 57 EXPECT_EQ(*opt, 1);
63 58
64 - app.reset();  
65 args = {"--count", "3"}; 59 args = {"--count", "3"};
66 run(); 60 run();
67 EXPECT_TRUE(opt); 61 EXPECT_TRUE(opt);
tests/SubcommandTest.cpp
@@ -21,12 +21,12 @@ TEST_F(TApp, BasicSubcommands) { @@ -21,12 +21,12 @@ TEST_F(TApp, BasicSubcommands) {
21 run(); 21 run();
22 EXPECT_EQ((size_t)0, app.get_subcommands().size()); 22 EXPECT_EQ((size_t)0, app.get_subcommands().size());
23 23
24 - app.reset();  
25 args = {"sub1"}; 24 args = {"sub1"};
26 run(); 25 run();
27 EXPECT_EQ(sub1, app.get_subcommands().at(0)); 26 EXPECT_EQ(sub1, app.get_subcommands().at(0));
  27 + EXPECT_EQ((size_t)1, app.get_subcommands().size());
28 28
29 - app.reset(); 29 + app.clear();
30 EXPECT_EQ((size_t)0, app.get_subcommands().size()); 30 EXPECT_EQ((size_t)0, app.get_subcommands().size());
31 31
32 args = {"sub2"}; 32 args = {"sub2"};
@@ -34,19 +34,18 @@ TEST_F(TApp, BasicSubcommands) { @@ -34,19 +34,18 @@ TEST_F(TApp, BasicSubcommands) {
34 EXPECT_EQ((size_t)1, app.get_subcommands().size()); 34 EXPECT_EQ((size_t)1, app.get_subcommands().size());
35 EXPECT_EQ(sub2, app.get_subcommands().at(0)); 35 EXPECT_EQ(sub2, app.get_subcommands().at(0));
36 36
37 - app.reset();  
38 args = {"SUb2"}; 37 args = {"SUb2"};
39 EXPECT_THROW(run(), CLI::ExtrasError); 38 EXPECT_THROW(run(), CLI::ExtrasError);
  39 + app.clear();
40 40
41 - app.reset();  
42 args = {"SUb2"}; 41 args = {"SUb2"};
43 try { 42 try {
44 run(); 43 run();
45 } catch(const CLI::ExtrasError &e) { 44 } catch(const CLI::ExtrasError &e) {
46 EXPECT_THAT(e.what(), HasSubstr("SUb2")); 45 EXPECT_THAT(e.what(), HasSubstr("SUb2"));
47 } 46 }
  47 + app.clear();
48 48
49 - app.reset();  
50 args = {"sub1", "extra"}; 49 args = {"sub1", "extra"};
51 try { 50 try {
52 run(); 51 run();
@@ -72,22 +71,19 @@ TEST_F(TApp, MultiSubFallthrough) { @@ -72,22 +71,19 @@ TEST_F(TApp, MultiSubFallthrough) {
72 EXPECT_TRUE(app.got_subcommand(sub2)); 71 EXPECT_TRUE(app.got_subcommand(sub2));
73 EXPECT_TRUE(*sub2); 72 EXPECT_TRUE(*sub2);
74 73
75 - app.reset();  
76 app.require_subcommand(); 74 app.require_subcommand();
77 75
78 run(); 76 run();
79 77
80 - app.reset();  
81 app.require_subcommand(2); 78 app.require_subcommand(2);
82 79
83 run(); 80 run();
84 81
85 - app.reset();  
86 app.require_subcommand(1); 82 app.require_subcommand(1);
87 83
88 EXPECT_THROW(run(), CLI::ExtrasError); 84 EXPECT_THROW(run(), CLI::ExtrasError);
  85 + app.clear();
89 86
90 - app.reset();  
91 args = {"sub1"}; 87 args = {"sub1"};
92 run(); 88 run();
93 89
@@ -109,24 +105,21 @@ TEST_F(TApp, RequiredAndSubcoms) { // #23 @@ -109,24 +105,21 @@ TEST_F(TApp, RequiredAndSubcoms) { // #23
109 auto bar = app.add_subcommand("bar"); 105 auto bar = app.add_subcommand("bar");
110 106
111 args = {"bar", "foo"}; 107 args = {"bar", "foo"};
112 - EXPECT_NO_THROW(run()); 108 + ASSERT_NO_THROW(run());
113 EXPECT_TRUE(*foo); 109 EXPECT_TRUE(*foo);
114 EXPECT_FALSE(*bar); 110 EXPECT_FALSE(*bar);
115 EXPECT_EQ(baz, "bar"); 111 EXPECT_EQ(baz, "bar");
116 112
117 - app.reset();  
118 args = {"foo"}; 113 args = {"foo"};
119 - EXPECT_NO_THROW(run()); 114 + ASSERT_NO_THROW(run());
120 EXPECT_FALSE(*foo); 115 EXPECT_FALSE(*foo);
121 EXPECT_EQ(baz, "foo"); 116 EXPECT_EQ(baz, "foo");
122 117
123 - app.reset();  
124 args = {"foo", "foo"}; 118 args = {"foo", "foo"};
125 - EXPECT_NO_THROW(run()); 119 + ASSERT_NO_THROW(run());
126 EXPECT_TRUE(*foo); 120 EXPECT_TRUE(*foo);
127 EXPECT_EQ(baz, "foo"); 121 EXPECT_EQ(baz, "foo");
128 122
129 - app.reset();  
130 args = {"foo", "other"}; 123 args = {"foo", "other"};
131 EXPECT_THROW(run(), CLI::ExtrasError); 124 EXPECT_THROW(run(), CLI::ExtrasError);
132 } 125 }
@@ -144,7 +137,6 @@ TEST_F(TApp, RequiredAndSubcomFallthrough) { @@ -144,7 +137,6 @@ TEST_F(TApp, RequiredAndSubcomFallthrough) {
144 EXPECT_TRUE(bar); 137 EXPECT_TRUE(bar);
145 EXPECT_EQ(baz, "other"); 138 EXPECT_EQ(baz, "other");
146 139
147 - app.reset();  
148 args = {"bar", "other2"}; 140 args = {"bar", "other2"};
149 EXPECT_THROW(run(), CLI::ExtrasError); 141 EXPECT_THROW(run(), CLI::ExtrasError);
150 } 142 }
@@ -164,7 +156,6 @@ TEST_F(TApp, FooFooProblem) { @@ -164,7 +156,6 @@ TEST_F(TApp, FooFooProblem) {
164 EXPECT_EQ(baz_str, ""); 156 EXPECT_EQ(baz_str, "");
165 EXPECT_EQ(other_str, "foo"); 157 EXPECT_EQ(other_str, "foo");
166 158
167 - app.reset();  
168 baz_str = ""; 159 baz_str = "";
169 other_str = ""; 160 other_str = "";
170 baz->required(); 161 baz->required();
@@ -198,19 +189,18 @@ TEST_F(TApp, RuntimeErrorInCallback) { @@ -198,19 +189,18 @@ TEST_F(TApp, RuntimeErrorInCallback) {
198 args = {"sub1"}; 189 args = {"sub1"};
199 EXPECT_THROW(run(), CLI::RuntimeError); 190 EXPECT_THROW(run(), CLI::RuntimeError);
200 191
201 - app.reset();  
202 args = {"sub1"}; 192 args = {"sub1"};
203 try { 193 try {
204 run(); 194 run();
205 } catch(const CLI::RuntimeError &e) { 195 } catch(const CLI::RuntimeError &e) {
206 EXPECT_EQ(1, e.get_exit_code()); 196 EXPECT_EQ(1, e.get_exit_code());
207 } 197 }
  198 + app.clear();
208 199
209 - app.reset();  
210 args = {"sub2"}; 200 args = {"sub2"};
211 EXPECT_THROW(run(), CLI::RuntimeError); 201 EXPECT_THROW(run(), CLI::RuntimeError);
  202 + app.clear();
212 203
213 - app.reset();  
214 args = {"sub2"}; 204 args = {"sub2"};
215 try { 205 try {
216 run(); 206 run();
@@ -316,7 +306,6 @@ TEST_F(TApp, CallbackOrdering) { @@ -316,7 +306,6 @@ TEST_F(TApp, CallbackOrdering) {
316 EXPECT_EQ(2, val); 306 EXPECT_EQ(2, val);
317 EXPECT_EQ(2, sub_val); 307 EXPECT_EQ(2, sub_val);
318 308
319 - app.reset();  
320 args = {"--val=2", "sub"}; 309 args = {"--val=2", "sub"};
321 run(); 310 run();
322 EXPECT_EQ(2, val); 311 EXPECT_EQ(2, val);
@@ -330,11 +319,9 @@ TEST_F(TApp, RequiredSubCom) { @@ -330,11 +319,9 @@ TEST_F(TApp, RequiredSubCom) {
330 app.require_subcommand(); 319 app.require_subcommand();
331 320
332 EXPECT_THROW(run(), CLI::RequiredError); 321 EXPECT_THROW(run(), CLI::RequiredError);
333 -  
334 - app.reset(); 322 + app.clear();
335 323
336 args = {"sub1"}; 324 args = {"sub1"};
337 -  
338 run(); 325 run();
339 } 326 }
340 327
@@ -347,22 +334,16 @@ TEST_F(TApp, SubComExtras) { @@ -347,22 +334,16 @@ TEST_F(TApp, SubComExtras) {
347 EXPECT_EQ(app.remaining(), std::vector<std::string>({"extra"})); 334 EXPECT_EQ(app.remaining(), std::vector<std::string>({"extra"}));
348 EXPECT_EQ(sub->remaining(), std::vector<std::string>()); 335 EXPECT_EQ(sub->remaining(), std::vector<std::string>());
349 336
350 - app.reset();  
351 -  
352 args = {"extra1", "extra2", "sub"}; 337 args = {"extra1", "extra2", "sub"};
353 run(); 338 run();
354 EXPECT_EQ(app.remaining(), std::vector<std::string>({"extra1", "extra2"})); 339 EXPECT_EQ(app.remaining(), std::vector<std::string>({"extra1", "extra2"}));
355 EXPECT_EQ(sub->remaining(), std::vector<std::string>()); 340 EXPECT_EQ(sub->remaining(), std::vector<std::string>());
356 341
357 - app.reset();  
358 -  
359 args = {"sub", "extra1", "extra2"}; 342 args = {"sub", "extra1", "extra2"};
360 run(); 343 run();
361 EXPECT_EQ(app.remaining(), std::vector<std::string>()); 344 EXPECT_EQ(app.remaining(), std::vector<std::string>());
362 EXPECT_EQ(sub->remaining(), std::vector<std::string>({"extra1", "extra2"})); 345 EXPECT_EQ(sub->remaining(), std::vector<std::string>({"extra1", "extra2"}));
363 346
364 - app.reset();  
365 -  
366 args = {"extra1", "extra2", "sub", "extra3", "extra4"}; 347 args = {"extra1", "extra2", "sub", "extra3", "extra4"};
367 run(); 348 run();
368 EXPECT_EQ(app.remaining(), std::vector<std::string>({"extra1", "extra2"})); 349 EXPECT_EQ(app.remaining(), std::vector<std::string>({"extra1", "extra2"}));
@@ -377,12 +358,11 @@ TEST_F(TApp, Required1SubCom) { @@ -377,12 +358,11 @@ TEST_F(TApp, Required1SubCom) {
377 app.add_subcommand("sub3"); 358 app.add_subcommand("sub3");
378 359
379 EXPECT_THROW(run(), CLI::RequiredError); 360 EXPECT_THROW(run(), CLI::RequiredError);
  361 + app.clear();
380 362
381 - app.reset();  
382 args = {"sub1"}; 363 args = {"sub1"};
383 run(); 364 run();
384 365
385 - app.reset();  
386 args = {"sub1", "sub2"}; 366 args = {"sub1", "sub2"};
387 EXPECT_THROW(run(), CLI::ExtrasError); 367 EXPECT_THROW(run(), CLI::ExtrasError);
388 } 368 }
@@ -522,16 +502,14 @@ TEST_F(SubcommandProgram, MultipleArgs) { @@ -522,16 +502,14 @@ TEST_F(SubcommandProgram, MultipleArgs) {
522 TEST_F(SubcommandProgram, CaseCheck) { 502 TEST_F(SubcommandProgram, CaseCheck) {
523 args = {"Start"}; 503 args = {"Start"};
524 EXPECT_THROW(run(), CLI::ExtrasError); 504 EXPECT_THROW(run(), CLI::ExtrasError);
  505 + app.clear();
525 506
526 - app.reset();  
527 args = {"start"}; 507 args = {"start"};
528 run(); 508 run();
529 509
530 - app.reset();  
531 start->ignore_case(); 510 start->ignore_case();
532 run(); 511 run();
533 512
534 - app.reset();  
535 args = {"Start"}; 513 args = {"Start"};
536 run(); 514 run();
537 } 515 }
@@ -546,12 +524,12 @@ TEST_F(TApp, SubcomInheritCaseCheck) { @@ -546,12 +524,12 @@ TEST_F(TApp, SubcomInheritCaseCheck) {
546 EXPECT_EQ((size_t)2, app.get_subcommands({}).size()); 524 EXPECT_EQ((size_t)2, app.get_subcommands({}).size());
547 EXPECT_EQ((size_t)1, app.get_subcommands([](const CLI::App *s) { return s->get_name() == "sub1"; }).size()); 525 EXPECT_EQ((size_t)1, app.get_subcommands([](const CLI::App *s) { return s->get_name() == "sub1"; }).size());
548 526
549 - app.reset();  
550 args = {"SuB1"}; 527 args = {"SuB1"};
551 run(); 528 run();
552 EXPECT_EQ(sub1, app.get_subcommands().at(0)); 529 EXPECT_EQ(sub1, app.get_subcommands().at(0));
  530 + EXPECT_EQ((size_t)1, app.get_subcommands().size());
553 531
554 - app.reset(); 532 + app.clear();
555 EXPECT_EQ((size_t)0, app.get_subcommands().size()); 533 EXPECT_EQ((size_t)0, app.get_subcommands().size());
556 534
557 args = {"sUb2"}; 535 args = {"sUb2"};
@@ -577,8 +555,6 @@ TEST_F(SubcommandProgram, Callbacks) { @@ -577,8 +555,6 @@ TEST_F(SubcommandProgram, Callbacks) {
577 555
578 run(); 556 run();
579 557
580 - app.reset();  
581 -  
582 args = {"start"}; 558 args = {"start"};
583 559
584 EXPECT_THROW(run(), CLI::Success); 560 EXPECT_THROW(run(), CLI::Success);
@@ -606,15 +582,15 @@ TEST_F(SubcommandProgram, ExtrasErrors) { @@ -606,15 +582,15 @@ TEST_F(SubcommandProgram, ExtrasErrors) {
606 582
607 args = {"one", "two", "start", "three", "four"}; 583 args = {"one", "two", "start", "three", "four"};
608 EXPECT_THROW(run(), CLI::ExtrasError); 584 EXPECT_THROW(run(), CLI::ExtrasError);
609 - app.reset(); 585 + app.clear();
610 586
611 args = {"start", "three", "four"}; 587 args = {"start", "three", "four"};
612 EXPECT_THROW(run(), CLI::ExtrasError); 588 EXPECT_THROW(run(), CLI::ExtrasError);
613 - app.reset(); 589 + app.clear();
614 590
615 args = {"one", "two"}; 591 args = {"one", "two"};
616 EXPECT_THROW(run(), CLI::ExtrasError); 592 EXPECT_THROW(run(), CLI::ExtrasError);
617 - app.reset(); 593 + app.clear();
618 } 594 }
619 595
620 TEST_F(SubcommandProgram, OrderedExtras) { 596 TEST_F(SubcommandProgram, OrderedExtras) {
@@ -622,7 +598,7 @@ TEST_F(SubcommandProgram, OrderedExtras) { @@ -622,7 +598,7 @@ TEST_F(SubcommandProgram, OrderedExtras) {
622 app.allow_extras(); 598 app.allow_extras();
623 args = {"one", "two", "start", "three", "four"}; 599 args = {"one", "two", "start", "three", "four"};
624 EXPECT_THROW(run(), CLI::ExtrasError); 600 EXPECT_THROW(run(), CLI::ExtrasError);
625 - app.reset(); 601 + app.clear();
626 602
627 start->allow_extras(); 603 start->allow_extras();
628 604
@@ -632,7 +608,6 @@ TEST_F(SubcommandProgram, OrderedExtras) { @@ -632,7 +608,6 @@ TEST_F(SubcommandProgram, OrderedExtras) {
632 EXPECT_EQ(start->remaining(), std::vector<std::string>({"three", "four"})); 608 EXPECT_EQ(start->remaining(), std::vector<std::string>({"three", "four"}));
633 EXPECT_EQ(app.remaining(true), std::vector<std::string>({"one", "two", "three", "four"})); 609 EXPECT_EQ(app.remaining(true), std::vector<std::string>({"one", "two", "three", "four"}));
634 610
635 - app.reset();  
636 args = {"one", "two", "start", "three", "--", "four"}; 611 args = {"one", "two", "start", "three", "--", "four"};
637 612
638 run(); 613 run();
@@ -656,7 +631,6 @@ TEST_F(SubcommandProgram, MixedOrderExtras) { @@ -656,7 +631,6 @@ TEST_F(SubcommandProgram, MixedOrderExtras) {
656 EXPECT_EQ(stop->remaining(), std::vector<std::string>({"five", "six"})); 631 EXPECT_EQ(stop->remaining(), std::vector<std::string>({"five", "six"}));
657 EXPECT_EQ(app.remaining(true), std::vector<std::string>({"one", "two", "three", "four", "five", "six"})); 632 EXPECT_EQ(app.remaining(true), std::vector<std::string>({"one", "two", "three", "four", "five", "six"}));
658 633
659 - app.reset();  
660 args = {"one", "two", "stop", "three", "four", "start", "five", "six"}; 634 args = {"one", "two", "stop", "three", "four", "start", "five", "six"};
661 run(); 635 run();
662 636
@@ -675,7 +649,6 @@ TEST_F(SubcommandProgram, CallbackOrder) { @@ -675,7 +649,6 @@ TEST_F(SubcommandProgram, CallbackOrder) {
675 run(); 649 run();
676 EXPECT_EQ(callback_order, std::vector<int>({1, 2})); 650 EXPECT_EQ(callback_order, std::vector<int>({1, 2}));
677 651
678 - app.reset();  
679 callback_order.clear(); 652 callback_order.clear();
680 653
681 args = {"stop", "start"}; 654 args = {"stop", "start"};
@@ -728,7 +701,6 @@ TEST_F(ManySubcommands, Required1Fuzzy) { @@ -728,7 +701,6 @@ TEST_F(ManySubcommands, Required1Fuzzy) {
728 run(); 701 run();
729 EXPECT_EQ(sub1->remaining(), vs_t({"sub2", "sub3"})); 702 EXPECT_EQ(sub1->remaining(), vs_t({"sub2", "sub3"}));
730 703
731 - app.reset();  
732 app.require_subcommand(-1); 704 app.require_subcommand(-1);
733 705
734 run(); 706 run();
@@ -742,7 +714,6 @@ TEST_F(ManySubcommands, Required2Fuzzy) { @@ -742,7 +714,6 @@ TEST_F(ManySubcommands, Required2Fuzzy) {
742 EXPECT_EQ(sub2->remaining(), vs_t({"sub3"})); 714 EXPECT_EQ(sub2->remaining(), vs_t({"sub3"}));
743 EXPECT_EQ(app.remaining(true), vs_t({"sub3"})); 715 EXPECT_EQ(app.remaining(true), vs_t({"sub3"}));
744 716
745 - app.reset();  
746 app.require_subcommand(-2); 717 app.require_subcommand(-2);
747 718
748 run(); 719 run();
@@ -753,13 +724,11 @@ TEST_F(ManySubcommands, Unlimited) { @@ -753,13 +724,11 @@ TEST_F(ManySubcommands, Unlimited) {
753 run(); 724 run();
754 EXPECT_EQ(app.remaining(true), vs_t()); 725 EXPECT_EQ(app.remaining(true), vs_t());
755 726
756 - app.reset();  
757 app.require_subcommand(); 727 app.require_subcommand();
758 728
759 run(); 729 run();
760 EXPECT_EQ(app.remaining(true), vs_t()); 730 EXPECT_EQ(app.remaining(true), vs_t());
761 731
762 - app.reset();  
763 app.require_subcommand(2, 0); // 2 or more 732 app.require_subcommand(2, 0); // 2 or more
764 733
765 run(); 734 run();