1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-03 14:03:52 +00:00

Bugfix: Single line now counts as a flag in INI

This commit is contained in:
Henry Fredrick Schreiner 2017-03-09 08:41:22 -05:00
parent 9690ef1b01
commit 2c837f9b06
2 changed files with 7 additions and 4 deletions

View File

@ -68,8 +68,10 @@ std::vector<ini_ret_t> 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;

View File

@ -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);
}