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:
parent
9690ef1b01
commit
2c837f9b06
@ -68,8 +68,10 @@ std::vector<ini_ret_t> parse_ini(std::istream &input) {
|
|||||||
name = detail::trim_copy(line.substr(0,pos));
|
name = detail::trim_copy(line.substr(0,pos));
|
||||||
std::string item = detail::trim_copy(line.substr(pos+1));
|
std::string item = detail::trim_copy(line.substr(pos+1));
|
||||||
items = detail::split_up(item);
|
items = detail::split_up(item);
|
||||||
} else
|
} else {
|
||||||
name = detail::trim_copy(line);
|
name = detail::trim_copy(line);
|
||||||
|
items = {"ON"};
|
||||||
|
}
|
||||||
|
|
||||||
if(detail::to_lower(section) == "default")
|
if(detail::to_lower(section) == "default")
|
||||||
out.fullname = name;
|
out.fullname = name;
|
||||||
|
@ -273,9 +273,7 @@ TEST_F(TApp, IniVector) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TApp, IniFlags) {
|
TEST_F(TApp, IniFlags) {
|
||||||
|
|
||||||
TempFile tmpini{"TestIniTmp.ini"};
|
TempFile tmpini{"TestIniTmp.ini"};
|
||||||
|
|
||||||
app.add_config("--config", tmpini);
|
app.add_config("--config", tmpini);
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -284,19 +282,22 @@ TEST_F(TApp, IniFlags) {
|
|||||||
out << "two=2" << std::endl;
|
out << "two=2" << std::endl;
|
||||||
out << "three=true" << std::endl;
|
out << "three=true" << std::endl;
|
||||||
out << "four=on" << std::endl;
|
out << "four=on" << std::endl;
|
||||||
|
out << "five" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int two;
|
int two;
|
||||||
bool three, four;
|
bool three, four, five;
|
||||||
app.add_flag("--two", two);
|
app.add_flag("--two", two);
|
||||||
app.add_flag("--three", three);
|
app.add_flag("--three", three);
|
||||||
app.add_flag("--four", four);
|
app.add_flag("--four", four);
|
||||||
|
app.add_flag("--five", five);
|
||||||
|
|
||||||
run();
|
run();
|
||||||
|
|
||||||
EXPECT_EQ(2, two);
|
EXPECT_EQ(2, two);
|
||||||
EXPECT_EQ(true, three);
|
EXPECT_EQ(true, three);
|
||||||
EXPECT_EQ(true, four);
|
EXPECT_EQ(true, four);
|
||||||
|
EXPECT_EQ(true, five);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user