@@ -1016,15 +1016,18 @@ TEST_CASE_METHOD(TApp, "TOMLStringVector", "[config]") {
1016
1016
out << " [default]\n " ;
1017
1017
out << " zero1=[]\n " ;
1018
1018
out << " zero2={}\n " ;
1019
+ out << " zero3={}\n " ;
1019
1020
out << " nzero={}\n " ;
1020
1021
out << " one=[\" 1\" ]\n " ;
1021
1022
out << " two=[\" 2\" ,\" 3\" ]\n " ;
1022
1023
out << " three=[\" 1\" ,\" 2\" ,\" 3\" ]\n " ;
1023
1024
}
1024
1025
1025
- std::vector<std::string> nzero, zero1, zero2, one, two, three;
1026
+ std::vector<std::string> nzero, zero1, zero2, zero3, one, two, three;
1026
1027
app.add_option (" --zero1" , zero1)->required ()->expected (0 , 99 )->default_str (" {}" );
1027
1028
app.add_option (" --zero2" , zero2)->required ()->expected (0 , 99 )->default_val (std::vector<std::string>{});
1029
+ // if no default is specified the argument results in an empty string
1030
+ app.add_option (" --zero3" , zero3)->required ()->expected (0 , 99 );
1028
1031
app.add_option (" --nzero" , nzero)->required ();
1029
1032
app.add_option (" --one" , one)->required ();
1030
1033
app.add_option (" --two" , two)->required ();
@@ -1034,6 +1037,7 @@ TEST_CASE_METHOD(TApp, "TOMLStringVector", "[config]") {
1034
1037
1035
1038
CHECK (zero1 == std::vector<std::string>({}));
1036
1039
CHECK (zero2 == std::vector<std::string>({}));
1040
+ CHECK (zero3 == std::vector<std::string>({" " }));
1037
1041
CHECK (nzero == std::vector<std::string>({" {}" }));
1038
1042
CHECK (one == std::vector<std::string>({" 1" }));
1039
1043
CHECK (two == std::vector<std::string>({" 2" , " 3" }));
0 commit comments