diff --git a/include/CLI/Ini.hpp b/include/CLI/Ini.hpp index 3623ea50..e7026e01 100644 --- a/include/CLI/Ini.hpp +++ b/include/CLI/Ini.hpp @@ -68,8 +68,10 @@ std::vector parse_ini(std::istream &input) { name = detail::trim_copy(line.substr(0,pos)); std::string item = detail::trim_copy(line.substr(pos+1)); items = detail::split_up(item); - } else + } else { name = detail::trim_copy(line); + items = {"ON"}; + } if(detail::to_lower(section) == "default") out.fullname = name; diff --git a/tests/IniTest.cpp b/tests/IniTest.cpp index f603e094..16c532f5 100644 --- a/tests/IniTest.cpp +++ b/tests/IniTest.cpp @@ -273,9 +273,7 @@ TEST_F(TApp, IniVector) { } TEST_F(TApp, IniFlags) { - TempFile tmpini{"TestIniTmp.ini"}; - app.add_config("--config", tmpini); { @@ -284,19 +282,22 @@ TEST_F(TApp, IniFlags) { out << "two=2" << std::endl; out << "three=true" << std::endl; out << "four=on" << std::endl; + out << "five" << std::endl; } int two; - bool three, four; + bool three, four, five; app.add_flag("--two", two); app.add_flag("--three", three); app.add_flag("--four", four); + app.add_flag("--five", five); run(); EXPECT_EQ(2, two); EXPECT_EQ(true, three); EXPECT_EQ(true, four); + EXPECT_EQ(true, five); }