Skip to content

Commit ccb6d8b

Browse files
committed
add no default test
1 parent d96bf19 commit ccb6d8b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/ConfigFileTest.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,15 +1016,18 @@ TEST_CASE_METHOD(TApp, "TOMLStringVector", "[config]") {
10161016
out << "[default]\n";
10171017
out << "zero1=[]\n";
10181018
out << "zero2={}\n";
1019+
out << "zero3={}\n";
10191020
out << "nzero={}\n";
10201021
out << "one=[\"1\"]\n";
10211022
out << "two=[\"2\",\"3\"]\n";
10221023
out << "three=[\"1\",\"2\",\"3\"]\n";
10231024
}
10241025

1025-
std::vector<std::string> nzero, zero1, zero2, one, two, three;
1026+
std::vector<std::string> nzero, zero1, zero2, zero3, one, two, three;
10261027
app.add_option("--zero1", zero1)->required()->expected(0, 99)->default_str("{}");
10271028
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);
10281031
app.add_option("--nzero", nzero)->required();
10291032
app.add_option("--one", one)->required();
10301033
app.add_option("--two", two)->required();
@@ -1034,6 +1037,7 @@ TEST_CASE_METHOD(TApp, "TOMLStringVector", "[config]") {
10341037

10351038
CHECK(zero1 == std::vector<std::string>({}));
10361039
CHECK(zero2 == std::vector<std::string>({}));
1040+
CHECK(zero3 == std::vector<std::string>({""}));
10371041
CHECK(nzero == std::vector<std::string>({"{}"}));
10381042
CHECK(one == std::vector<std::string>({"1"}));
10391043
CHECK(two == std::vector<std::string>({"2", "3"}));

0 commit comments

Comments
 (0)