Commit 85aa0e7813a8ec927da5fe08bd265f1303cc272e
Committed by
Henry Schreiner
1 parent
bf4ad1d7
Dropping last (required) usages of clear
Showing
5 changed files
with
5 additions
and
49 deletions
include/CLI/App.hpp
| @@ -914,6 +914,11 @@ class App { | @@ -914,6 +914,11 @@ class App { | ||
| 914 | if(parsed_) | 914 | if(parsed_) |
| 915 | clear(); | 915 | clear(); |
| 916 | 916 | ||
| 917 | + // Redundant (set by _parse on commands/subcommands) | ||
| 918 | + // but placed here to make sure this is cleared when | ||
| 919 | + // running parse after an error is thrown, even by _validate. | ||
| 920 | + parsed_ = true; | ||
| 921 | + | ||
| 917 | _validate(); | 922 | _validate(); |
| 918 | _parse(args); | 923 | _parse(args); |
| 919 | run_callback(); | 924 | run_callback(); |
tests/AppTest.cpp
| @@ -326,7 +326,6 @@ TEST_F(TApp, MissingValueNonRequiredOpt) { | @@ -326,7 +326,6 @@ TEST_F(TApp, MissingValueNonRequiredOpt) { | ||
| 326 | 326 | ||
| 327 | args = {"-c"}; | 327 | args = {"-c"}; |
| 328 | EXPECT_THROW(run(), CLI::ArgumentMismatch); | 328 | EXPECT_THROW(run(), CLI::ArgumentMismatch); |
| 329 | - app.clear(); | ||
| 330 | 329 | ||
| 331 | args = {"--count"}; | 330 | args = {"--count"}; |
| 332 | EXPECT_THROW(run(), CLI::ArgumentMismatch); | 331 | EXPECT_THROW(run(), CLI::ArgumentMismatch); |
| @@ -340,7 +339,6 @@ TEST_F(TApp, MissingValueMoreThan) { | @@ -340,7 +339,6 @@ TEST_F(TApp, MissingValueMoreThan) { | ||
| 340 | 339 | ||
| 341 | args = {"-v", "2"}; | 340 | args = {"-v", "2"}; |
| 342 | EXPECT_THROW(run(), CLI::ArgumentMismatch); | 341 | EXPECT_THROW(run(), CLI::ArgumentMismatch); |
| 343 | - app.clear(); | ||
| 344 | 342 | ||
| 345 | args = {"--vals", "4"}; | 343 | args = {"--vals", "4"}; |
| 346 | EXPECT_THROW(run(), CLI::ArgumentMismatch); | 344 | EXPECT_THROW(run(), CLI::ArgumentMismatch); |
| @@ -410,7 +408,6 @@ TEST_F(TApp, RequiredOptsDouble) { | @@ -410,7 +408,6 @@ TEST_F(TApp, RequiredOptsDouble) { | ||
| 410 | 408 | ||
| 411 | EXPECT_THROW(run(), CLI::ArgumentMismatch); | 409 | EXPECT_THROW(run(), CLI::ArgumentMismatch); |
| 412 | 410 | ||
| 413 | - app.clear(); | ||
| 414 | args = {"--str", "one", "two"}; | 411 | args = {"--str", "one", "two"}; |
| 415 | 412 | ||
| 416 | run(); | 413 | run(); |
| @@ -426,7 +423,6 @@ TEST_F(TApp, RequiredOptsDoubleShort) { | @@ -426,7 +423,6 @@ TEST_F(TApp, RequiredOptsDoubleShort) { | ||
| 426 | args = {"-s", "one"}; | 423 | args = {"-s", "one"}; |
| 427 | 424 | ||
| 428 | EXPECT_THROW(run(), CLI::ArgumentMismatch); | 425 | EXPECT_THROW(run(), CLI::ArgumentMismatch); |
| 429 | - app.clear(); | ||
| 430 | 426 | ||
| 431 | args = {"-s", "one", "-s", "one", "-s", "one"}; | 427 | args = {"-s", "one", "-s", "one", "-s", "one"}; |
| 432 | 428 | ||
| @@ -440,7 +436,6 @@ TEST_F(TApp, RequiredOptsDoubleNeg) { | @@ -440,7 +436,6 @@ TEST_F(TApp, RequiredOptsDoubleNeg) { | ||
| 440 | args = {"-s", "one"}; | 436 | args = {"-s", "one"}; |
| 441 | 437 | ||
| 442 | EXPECT_THROW(run(), CLI::ArgumentMismatch); | 438 | EXPECT_THROW(run(), CLI::ArgumentMismatch); |
| 443 | - app.clear(); | ||
| 444 | 439 | ||
| 445 | args = {"-s", "one", "two", "-s", "three"}; | 440 | args = {"-s", "one", "two", "-s", "three"}; |
| 446 | 441 | ||
| @@ -503,7 +498,6 @@ TEST_F(TApp, RequiredOptsUnlimited) { | @@ -503,7 +498,6 @@ TEST_F(TApp, RequiredOptsUnlimited) { | ||
| 503 | 498 | ||
| 504 | args = {"--str"}; | 499 | args = {"--str"}; |
| 505 | EXPECT_THROW(run(), CLI::ArgumentMismatch); | 500 | EXPECT_THROW(run(), CLI::ArgumentMismatch); |
| 506 | - app.clear(); | ||
| 507 | 501 | ||
| 508 | args = {"--str", "one", "--str", "two"}; | 502 | args = {"--str", "one", "--str", "two"}; |
| 509 | run(); | 503 | run(); |
| @@ -546,7 +540,6 @@ TEST_F(TApp, RequiredOptsUnlimitedShort) { | @@ -546,7 +540,6 @@ TEST_F(TApp, RequiredOptsUnlimitedShort) { | ||
| 546 | 540 | ||
| 547 | args = {"-s"}; | 541 | args = {"-s"}; |
| 548 | EXPECT_THROW(run(), CLI::ArgumentMismatch); | 542 | EXPECT_THROW(run(), CLI::ArgumentMismatch); |
| 549 | - app.clear(); | ||
| 550 | 543 | ||
| 551 | args = {"-s", "one", "-s", "two"}; | 544 | args = {"-s", "one", "-s", "two"}; |
| 552 | run(); | 545 | run(); |
| @@ -660,15 +653,12 @@ TEST_F(TApp, RequiredFlags) { | @@ -660,15 +653,12 @@ TEST_F(TApp, RequiredFlags) { | ||
| 660 | app.add_flag("-b")->mandatory(); // Alternate term | 653 | app.add_flag("-b")->mandatory(); // Alternate term |
| 661 | 654 | ||
| 662 | EXPECT_THROW(run(), CLI::RequiredError); | 655 | EXPECT_THROW(run(), CLI::RequiredError); |
| 663 | - app.clear(); | ||
| 664 | 656 | ||
| 665 | args = {"-a"}; | 657 | args = {"-a"}; |
| 666 | EXPECT_THROW(run(), CLI::RequiredError); | 658 | EXPECT_THROW(run(), CLI::RequiredError); |
| 667 | - app.clear(); | ||
| 668 | 659 | ||
| 669 | args = {"-b"}; | 660 | args = {"-b"}; |
| 670 | EXPECT_THROW(run(), CLI::RequiredError); | 661 | EXPECT_THROW(run(), CLI::RequiredError); |
| 671 | - app.clear(); | ||
| 672 | 662 | ||
| 673 | args = {"-a", "-b"}; | 663 | args = {"-a", "-b"}; |
| 674 | run(); | 664 | run(); |
| @@ -854,7 +844,6 @@ TEST_F(TApp, FileExists) { | @@ -854,7 +844,6 @@ TEST_F(TApp, FileExists) { | ||
| 854 | args = {"--file", myfile}; | 844 | args = {"--file", myfile}; |
| 855 | 845 | ||
| 856 | EXPECT_THROW(run(), CLI::ValidationError); | 846 | EXPECT_THROW(run(), CLI::ValidationError); |
| 857 | - app.clear(); | ||
| 858 | 847 | ||
| 859 | bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | 848 | bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file |
| 860 | EXPECT_TRUE(ok); | 849 | EXPECT_TRUE(ok); |
| @@ -934,7 +923,6 @@ TEST_F(TApp, FailSet) { | @@ -934,7 +923,6 @@ TEST_F(TApp, FailSet) { | ||
| 934 | 923 | ||
| 935 | args = {"--quick", "3", "--quick=2"}; | 924 | args = {"--quick", "3", "--quick=2"}; |
| 936 | EXPECT_THROW(run(), CLI::ArgumentMismatch); | 925 | EXPECT_THROW(run(), CLI::ArgumentMismatch); |
| 937 | - app.clear(); | ||
| 938 | 926 | ||
| 939 | args = {"--quick=hello"}; | 927 | args = {"--quick=hello"}; |
| 940 | EXPECT_THROW(run(), CLI::ConversionError); | 928 | EXPECT_THROW(run(), CLI::ConversionError); |
| @@ -949,7 +937,6 @@ TEST_F(TApp, FailLValueSet) { | @@ -949,7 +937,6 @@ TEST_F(TApp, FailLValueSet) { | ||
| 949 | 937 | ||
| 950 | args = {"--quick=hello"}; | 938 | args = {"--quick=hello"}; |
| 951 | EXPECT_THROW(run(), CLI::ConversionError); | 939 | EXPECT_THROW(run(), CLI::ConversionError); |
| 952 | - app.clear(); | ||
| 953 | 940 | ||
| 954 | args = {"--slow=hello"}; | 941 | args = {"--slow=hello"}; |
| 955 | EXPECT_THROW(run(), CLI::ConversionError); | 942 | EXPECT_THROW(run(), CLI::ConversionError); |
| @@ -974,7 +961,6 @@ TEST_F(TApp, InSetIgnoreCase) { | @@ -974,7 +961,6 @@ TEST_F(TApp, InSetIgnoreCase) { | ||
| 974 | 961 | ||
| 975 | args = {"--quick", "four"}; | 962 | args = {"--quick", "four"}; |
| 976 | EXPECT_THROW(run(), CLI::ConversionError); | 963 | EXPECT_THROW(run(), CLI::ConversionError); |
| 977 | - app.clear(); | ||
| 978 | 964 | ||
| 979 | args = {"--quick=one", "--quick=two"}; | 965 | args = {"--quick=one", "--quick=two"}; |
| 980 | EXPECT_THROW(run(), CLI::ArgumentMismatch); | 966 | EXPECT_THROW(run(), CLI::ArgumentMismatch); |
| @@ -1038,7 +1024,6 @@ TEST_F(TApp, VectorFancyOpts) { | @@ -1038,7 +1024,6 @@ TEST_F(TApp, VectorFancyOpts) { | ||
| 1038 | 1024 | ||
| 1039 | args = {"one", "two"}; | 1025 | args = {"one", "two"}; |
| 1040 | EXPECT_THROW(run(), CLI::RequiredError); | 1026 | EXPECT_THROW(run(), CLI::RequiredError); |
| 1041 | - app.clear(); | ||
| 1042 | 1027 | ||
| 1043 | EXPECT_THROW(run(), CLI::ParseError); | 1028 | EXPECT_THROW(run(), CLI::ParseError); |
| 1044 | } | 1029 | } |
| @@ -1089,7 +1074,6 @@ TEST_F(TApp, ExcludesFlags) { | @@ -1089,7 +1074,6 @@ TEST_F(TApp, ExcludesFlags) { | ||
| 1089 | 1074 | ||
| 1090 | args = {"--nostr", "-s"}; | 1075 | args = {"--nostr", "-s"}; |
| 1091 | EXPECT_THROW(run(), CLI::ExcludesError); | 1076 | EXPECT_THROW(run(), CLI::ExcludesError); |
| 1092 | - app.clear(); | ||
| 1093 | 1077 | ||
| 1094 | args = {"--string", "--nostr"}; | 1078 | args = {"--string", "--nostr"}; |
| 1095 | EXPECT_THROW(run(), CLI::ExcludesError); | 1079 | EXPECT_THROW(run(), CLI::ExcludesError); |
| @@ -1111,7 +1095,6 @@ TEST_F(TApp, ExcludesMixedFlags) { | @@ -1111,7 +1095,6 @@ TEST_F(TApp, ExcludesMixedFlags) { | ||
| 1111 | 1095 | ||
| 1112 | args = {"--no", "--opt1"}; | 1096 | args = {"--no", "--opt1"}; |
| 1113 | EXPECT_THROW(run(), CLI::ExcludesError); | 1097 | EXPECT_THROW(run(), CLI::ExcludesError); |
| 1114 | - app.clear(); | ||
| 1115 | 1098 | ||
| 1116 | args = {"--no", "--opt2"}; | 1099 | args = {"--no", "--opt2"}; |
| 1117 | EXPECT_THROW(run(), CLI::ExcludesError); | 1100 | EXPECT_THROW(run(), CLI::ExcludesError); |
| @@ -1133,15 +1116,12 @@ TEST_F(TApp, NeedsMultiFlags) { | @@ -1133,15 +1116,12 @@ TEST_F(TApp, NeedsMultiFlags) { | ||
| 1133 | 1116 | ||
| 1134 | args = {"--optall"}; | 1117 | args = {"--optall"}; |
| 1135 | EXPECT_THROW(run(), CLI::RequiresError); | 1118 | EXPECT_THROW(run(), CLI::RequiresError); |
| 1136 | - app.clear(); | ||
| 1137 | 1119 | ||
| 1138 | args = {"--optall", "--opt1"}; | 1120 | args = {"--optall", "--opt1"}; |
| 1139 | EXPECT_THROW(run(), CLI::RequiresError); | 1121 | EXPECT_THROW(run(), CLI::RequiresError); |
| 1140 | - app.clear(); | ||
| 1141 | 1122 | ||
| 1142 | args = {"--optall", "--opt2", "--opt1"}; | 1123 | args = {"--optall", "--opt2", "--opt1"}; |
| 1143 | EXPECT_THROW(run(), CLI::RequiresError); | 1124 | EXPECT_THROW(run(), CLI::RequiresError); |
| 1144 | - app.clear(); | ||
| 1145 | 1125 | ||
| 1146 | args = {"--optall", "--opt1", "--opt2", "--opt3"}; | 1126 | args = {"--optall", "--opt1", "--opt2", "--opt3"}; |
| 1147 | run(); | 1127 | run(); |
| @@ -1163,15 +1143,12 @@ TEST_F(TApp, NeedsMixedFlags) { | @@ -1163,15 +1143,12 @@ TEST_F(TApp, NeedsMixedFlags) { | ||
| 1163 | 1143 | ||
| 1164 | args = {"--optall"}; | 1144 | args = {"--optall"}; |
| 1165 | EXPECT_THROW(run(), CLI::RequiresError); | 1145 | EXPECT_THROW(run(), CLI::RequiresError); |
| 1166 | - app.clear(); | ||
| 1167 | 1146 | ||
| 1168 | args = {"--optall", "--opt1"}; | 1147 | args = {"--optall", "--opt1"}; |
| 1169 | EXPECT_THROW(run(), CLI::RequiresError); | 1148 | EXPECT_THROW(run(), CLI::RequiresError); |
| 1170 | - app.clear(); | ||
| 1171 | 1149 | ||
| 1172 | args = {"--optall", "--opt2", "--opt1"}; | 1150 | args = {"--optall", "--opt2", "--opt1"}; |
| 1173 | EXPECT_THROW(run(), CLI::RequiresError); | 1151 | EXPECT_THROW(run(), CLI::RequiresError); |
| 1174 | - app.clear(); | ||
| 1175 | 1152 | ||
| 1176 | args = {"--optall", "--opt1", "--opt2", "--opt3"}; | 1153 | args = {"--optall", "--opt1", "--opt2", "--opt3"}; |
| 1177 | run(); | 1154 | run(); |
| @@ -1189,19 +1166,15 @@ TEST_F(TApp, NeedsChainedFlags) { | @@ -1189,19 +1166,15 @@ TEST_F(TApp, NeedsChainedFlags) { | ||
| 1189 | 1166 | ||
| 1190 | args = {"--opt2"}; | 1167 | args = {"--opt2"}; |
| 1191 | EXPECT_THROW(run(), CLI::RequiresError); | 1168 | EXPECT_THROW(run(), CLI::RequiresError); |
| 1192 | - app.clear(); | ||
| 1193 | 1169 | ||
| 1194 | args = {"--opt3"}; | 1170 | args = {"--opt3"}; |
| 1195 | EXPECT_THROW(run(), CLI::RequiresError); | 1171 | EXPECT_THROW(run(), CLI::RequiresError); |
| 1196 | - app.clear(); | ||
| 1197 | 1172 | ||
| 1198 | args = {"--opt3", "--opt2"}; | 1173 | args = {"--opt3", "--opt2"}; |
| 1199 | EXPECT_THROW(run(), CLI::RequiresError); | 1174 | EXPECT_THROW(run(), CLI::RequiresError); |
| 1200 | - app.clear(); | ||
| 1201 | 1175 | ||
| 1202 | args = {"--opt3", "--opt1"}; | 1176 | args = {"--opt3", "--opt1"}; |
| 1203 | EXPECT_THROW(run(), CLI::RequiresError); | 1177 | EXPECT_THROW(run(), CLI::RequiresError); |
| 1204 | - app.clear(); | ||
| 1205 | 1178 | ||
| 1206 | args = {"--opt2", "--opt1"}; | 1179 | args = {"--opt2", "--opt1"}; |
| 1207 | run(); | 1180 | run(); |
| @@ -1235,11 +1208,9 @@ TEST_F(TApp, RangeInt) { | @@ -1235,11 +1208,9 @@ TEST_F(TApp, RangeInt) { | ||
| 1235 | 1208 | ||
| 1236 | args = {"--one=1"}; | 1209 | args = {"--one=1"}; |
| 1237 | EXPECT_THROW(run(), CLI::ValidationError); | 1210 | EXPECT_THROW(run(), CLI::ValidationError); |
| 1238 | - app.clear(); | ||
| 1239 | 1211 | ||
| 1240 | args = {"--one=7"}; | 1212 | args = {"--one=7"}; |
| 1241 | EXPECT_THROW(run(), CLI::ValidationError); | 1213 | EXPECT_THROW(run(), CLI::ValidationError); |
| 1242 | - app.clear(); | ||
| 1243 | 1214 | ||
| 1244 | args = {"--one=3"}; | 1215 | args = {"--one=3"}; |
| 1245 | run(); | 1216 | run(); |
| @@ -1259,11 +1230,9 @@ TEST_F(TApp, RangeDouble) { | @@ -1259,11 +1230,9 @@ TEST_F(TApp, RangeDouble) { | ||
| 1259 | 1230 | ||
| 1260 | args = {"--one=1"}; | 1231 | args = {"--one=1"}; |
| 1261 | EXPECT_THROW(run(), CLI::ValidationError); | 1232 | EXPECT_THROW(run(), CLI::ValidationError); |
| 1262 | - app.clear(); | ||
| 1263 | 1233 | ||
| 1264 | args = {"--one=7"}; | 1234 | args = {"--one=7"}; |
| 1265 | EXPECT_THROW(run(), CLI::ValidationError); | 1235 | EXPECT_THROW(run(), CLI::ValidationError); |
| 1266 | - app.clear(); | ||
| 1267 | 1236 | ||
| 1268 | args = {"--one=3"}; | 1237 | args = {"--one=3"}; |
| 1269 | run(); | 1238 | run(); |
| @@ -1385,7 +1354,6 @@ TEST_F(TApp, ThrowingTransform) { | @@ -1385,7 +1354,6 @@ TEST_F(TApp, ThrowingTransform) { | ||
| 1385 | args = {"-mone"}; | 1354 | args = {"-mone"}; |
| 1386 | 1355 | ||
| 1387 | ASSERT_THROW(run(), CLI::ValidationError); | 1356 | ASSERT_THROW(run(), CLI::ValidationError); |
| 1388 | - app.clear(); | ||
| 1389 | 1357 | ||
| 1390 | try { | 1358 | try { |
| 1391 | run(); | 1359 | run(); |
| @@ -1456,7 +1424,6 @@ TEST_F(TApp, AddRemoveSetItems) { | @@ -1456,7 +1424,6 @@ TEST_F(TApp, AddRemoveSetItems) { | ||
| 1456 | 1424 | ||
| 1457 | args = {"--type1", "TYPE1"}; | 1425 | args = {"--type1", "TYPE1"}; |
| 1458 | EXPECT_THROW(run(), CLI::ConversionError); | 1426 | EXPECT_THROW(run(), CLI::ConversionError); |
| 1459 | - app.clear(); | ||
| 1460 | 1427 | ||
| 1461 | args = {"--type2", "TYPE2"}; | 1428 | args = {"--type2", "TYPE2"}; |
| 1462 | EXPECT_THROW(run(), CLI::ConversionError); | 1429 | EXPECT_THROW(run(), CLI::ConversionError); |
| @@ -1488,7 +1455,6 @@ TEST_F(TApp, AddRemoveSetItemsNoCase) { | @@ -1488,7 +1455,6 @@ TEST_F(TApp, AddRemoveSetItemsNoCase) { | ||
| 1488 | 1455 | ||
| 1489 | args = {"--type1", "TYPe1"}; | 1456 | args = {"--type1", "TYPe1"}; |
| 1490 | EXPECT_THROW(run(), CLI::ConversionError); | 1457 | EXPECT_THROW(run(), CLI::ConversionError); |
| 1491 | - app.clear(); | ||
| 1492 | 1458 | ||
| 1493 | args = {"--type2", "TYpE2"}; | 1459 | args = {"--type2", "TYpE2"}; |
| 1494 | EXPECT_THROW(run(), CLI::ConversionError); | 1460 | EXPECT_THROW(run(), CLI::ConversionError); |
tests/HelpTest.cpp
| @@ -326,11 +326,9 @@ TEST(THelp, OnlyOneAllHelp) { | @@ -326,11 +326,9 @@ 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(); | ||
| 330 | 329 | ||
| 331 | std::vector<std::string> input2{"--yelp"}; | 330 | std::vector<std::string> input2{"--yelp"}; |
| 332 | EXPECT_THROW(app.parse(input2), CLI::CallForAllHelp); | 331 | EXPECT_THROW(app.parse(input2), CLI::CallForAllHelp); |
| 333 | - app.clear(); | ||
| 334 | 332 | ||
| 335 | // Remove the flag | 333 | // Remove the flag |
| 336 | app.set_help_all_flag(); | 334 | app.set_help_all_flag(); |
tests/IniTest.cpp
| @@ -366,7 +366,6 @@ TEST_F(TApp, IniRequired) { | @@ -366,7 +366,6 @@ TEST_F(TApp, IniRequired) { | ||
| 366 | args = {}; | 366 | args = {}; |
| 367 | 367 | ||
| 368 | EXPECT_THROW(run(), CLI::RequiredError); | 368 | EXPECT_THROW(run(), CLI::RequiredError); |
| 369 | - app.clear(); | ||
| 370 | 369 | ||
| 371 | args = {"--two=2"}; | 370 | args = {"--two=2"}; |
| 372 | 371 |
tests/SubcommandTest.cpp
| @@ -36,7 +36,6 @@ TEST_F(TApp, BasicSubcommands) { | @@ -36,7 +36,6 @@ TEST_F(TApp, BasicSubcommands) { | ||
| 36 | 36 | ||
| 37 | args = {"SUb2"}; | 37 | args = {"SUb2"}; |
| 38 | EXPECT_THROW(run(), CLI::ExtrasError); | 38 | EXPECT_THROW(run(), CLI::ExtrasError); |
| 39 | - app.clear(); | ||
| 40 | 39 | ||
| 41 | args = {"SUb2"}; | 40 | args = {"SUb2"}; |
| 42 | try { | 41 | try { |
| @@ -44,7 +43,6 @@ TEST_F(TApp, BasicSubcommands) { | @@ -44,7 +43,6 @@ TEST_F(TApp, BasicSubcommands) { | ||
| 44 | } catch(const CLI::ExtrasError &e) { | 43 | } catch(const CLI::ExtrasError &e) { |
| 45 | EXPECT_THAT(e.what(), HasSubstr("SUb2")); | 44 | EXPECT_THAT(e.what(), HasSubstr("SUb2")); |
| 46 | } | 45 | } |
| 47 | - app.clear(); | ||
| 48 | 46 | ||
| 49 | args = {"sub1", "extra"}; | 47 | args = {"sub1", "extra"}; |
| 50 | try { | 48 | try { |
| @@ -82,7 +80,6 @@ TEST_F(TApp, MultiSubFallthrough) { | @@ -82,7 +80,6 @@ TEST_F(TApp, MultiSubFallthrough) { | ||
| 82 | app.require_subcommand(1); | 80 | app.require_subcommand(1); |
| 83 | 81 | ||
| 84 | EXPECT_THROW(run(), CLI::ExtrasError); | 82 | EXPECT_THROW(run(), CLI::ExtrasError); |
| 85 | - app.clear(); | ||
| 86 | 83 | ||
| 87 | args = {"sub1"}; | 84 | args = {"sub1"}; |
| 88 | run(); | 85 | run(); |
| @@ -195,11 +192,9 @@ TEST_F(TApp, RuntimeErrorInCallback) { | @@ -195,11 +192,9 @@ TEST_F(TApp, RuntimeErrorInCallback) { | ||
| 195 | } catch(const CLI::RuntimeError &e) { | 192 | } catch(const CLI::RuntimeError &e) { |
| 196 | EXPECT_EQ(1, e.get_exit_code()); | 193 | EXPECT_EQ(1, e.get_exit_code()); |
| 197 | } | 194 | } |
| 198 | - app.clear(); | ||
| 199 | 195 | ||
| 200 | args = {"sub2"}; | 196 | args = {"sub2"}; |
| 201 | EXPECT_THROW(run(), CLI::RuntimeError); | 197 | EXPECT_THROW(run(), CLI::RuntimeError); |
| 202 | - app.clear(); | ||
| 203 | 198 | ||
| 204 | args = {"sub2"}; | 199 | args = {"sub2"}; |
| 205 | try { | 200 | try { |
| @@ -319,7 +314,6 @@ TEST_F(TApp, RequiredSubCom) { | @@ -319,7 +314,6 @@ TEST_F(TApp, RequiredSubCom) { | ||
| 319 | app.require_subcommand(); | 314 | app.require_subcommand(); |
| 320 | 315 | ||
| 321 | EXPECT_THROW(run(), CLI::RequiredError); | 316 | EXPECT_THROW(run(), CLI::RequiredError); |
| 322 | - app.clear(); | ||
| 323 | 317 | ||
| 324 | args = {"sub1"}; | 318 | args = {"sub1"}; |
| 325 | run(); | 319 | run(); |
| @@ -358,7 +352,6 @@ TEST_F(TApp, Required1SubCom) { | @@ -358,7 +352,6 @@ TEST_F(TApp, Required1SubCom) { | ||
| 358 | app.add_subcommand("sub3"); | 352 | app.add_subcommand("sub3"); |
| 359 | 353 | ||
| 360 | EXPECT_THROW(run(), CLI::RequiredError); | 354 | EXPECT_THROW(run(), CLI::RequiredError); |
| 361 | - app.clear(); | ||
| 362 | 355 | ||
| 363 | args = {"sub1"}; | 356 | args = {"sub1"}; |
| 364 | run(); | 357 | run(); |
| @@ -502,7 +495,6 @@ TEST_F(SubcommandProgram, MultipleArgs) { | @@ -502,7 +495,6 @@ TEST_F(SubcommandProgram, MultipleArgs) { | ||
| 502 | TEST_F(SubcommandProgram, CaseCheck) { | 495 | TEST_F(SubcommandProgram, CaseCheck) { |
| 503 | args = {"Start"}; | 496 | args = {"Start"}; |
| 504 | EXPECT_THROW(run(), CLI::ExtrasError); | 497 | EXPECT_THROW(run(), CLI::ExtrasError); |
| 505 | - app.clear(); | ||
| 506 | 498 | ||
| 507 | args = {"start"}; | 499 | args = {"start"}; |
| 508 | run(); | 500 | run(); |
| @@ -582,15 +574,12 @@ TEST_F(SubcommandProgram, ExtrasErrors) { | @@ -582,15 +574,12 @@ TEST_F(SubcommandProgram, ExtrasErrors) { | ||
| 582 | 574 | ||
| 583 | args = {"one", "two", "start", "three", "four"}; | 575 | args = {"one", "two", "start", "three", "four"}; |
| 584 | EXPECT_THROW(run(), CLI::ExtrasError); | 576 | EXPECT_THROW(run(), CLI::ExtrasError); |
| 585 | - app.clear(); | ||
| 586 | 577 | ||
| 587 | args = {"start", "three", "four"}; | 578 | args = {"start", "three", "four"}; |
| 588 | EXPECT_THROW(run(), CLI::ExtrasError); | 579 | EXPECT_THROW(run(), CLI::ExtrasError); |
| 589 | - app.clear(); | ||
| 590 | 580 | ||
| 591 | args = {"one", "two"}; | 581 | args = {"one", "two"}; |
| 592 | EXPECT_THROW(run(), CLI::ExtrasError); | 582 | EXPECT_THROW(run(), CLI::ExtrasError); |
| 593 | - app.clear(); | ||
| 594 | } | 583 | } |
| 595 | 584 | ||
| 596 | TEST_F(SubcommandProgram, OrderedExtras) { | 585 | TEST_F(SubcommandProgram, OrderedExtras) { |
| @@ -598,7 +587,6 @@ TEST_F(SubcommandProgram, OrderedExtras) { | @@ -598,7 +587,6 @@ TEST_F(SubcommandProgram, OrderedExtras) { | ||
| 598 | app.allow_extras(); | 587 | app.allow_extras(); |
| 599 | args = {"one", "two", "start", "three", "four"}; | 588 | args = {"one", "two", "start", "three", "four"}; |
| 600 | EXPECT_THROW(run(), CLI::ExtrasError); | 589 | EXPECT_THROW(run(), CLI::ExtrasError); |
| 601 | - app.clear(); | ||
| 602 | 590 | ||
| 603 | start->allow_extras(); | 591 | start->allow_extras(); |
| 604 | 592 |