File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -564,6 +564,26 @@ TEST_F(TApp, LotsOfFlagsSingleStringExtraSpace) {
564564 EXPECT_EQ (1u , app.count (" -A" ));
565565}
566566
567+ TEST_F (TApp, SingleArgVector) {
568+
569+ std::vector<std::string> channels;
570+ std::vector<std::string> iargs;
571+ std::string path;
572+ app.add_option (" -c" , channels)->type_size (1 )->allow_extra_args (false );
573+ app.add_option (" args" , iargs);
574+ app.add_option (" -p" , path);
575+
576+ app.parse (" -c t1 -c t2 -c t3 a1 a2 a3 a4 -p happy" );
577+ EXPECT_EQ (3u , channels.size ());
578+ EXPECT_EQ (4u , iargs.size ());
579+ EXPECT_EQ (path, " happy" );
580+
581+ app.parse (" -c t1 a1 -c t2 -c t3 a2 a3 a4 -p happy" );
582+ EXPECT_EQ (3u , channels.size ());
583+ EXPECT_EQ (4u , iargs.size ());
584+ EXPECT_EQ (path, " happy" );
585+ }
586+
567587TEST_F (TApp, FlagLikeOption) {
568588 bool val{false };
569589 auto opt = app.add_option (" --flag" , val)->type_size (0 )->default_str (" true" );
Original file line number Diff line number Diff line change @@ -117,6 +117,19 @@ TEST_F(TApp, StdOptionalComplexDirect) {
117117 EXPECT_EQ (*opt, val2);
118118}
119119
120+ TEST_F (TApp, StdOptionalUint) {
121+ std::optional<std::uint64_t > opt;
122+ app.add_option (" -i,--int" , opt);
123+ run ();
124+ EXPECT_FALSE (opt);
125+
126+ args = {" -i" , " 15" };
127+ run ();
128+ EXPECT_EQ (*opt, 15U );
129+ static_assert (CLI::detail::classify_object<std::optional<std::uint64_t >>::value ==
130+ CLI::detail::object_category::wrapper_value);
131+ }
132+
120133#ifdef _MSC_VER
121134#pragma warning(default : 4244)
122135#endif
You can’t perform that action at this time.
0 commit comments