Skip to content

Commit

Permalink
fix a few sign comparison warnings and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
phlptp committed Dec 29, 2019
1 parent 7033784 commit 7a86355
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
15 changes: 6 additions & 9 deletions include/CLI/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2454,29 +2454,26 @@ class App {
try {
auto subcom = get_subcommand(item.parents.at(level));
auto result = subcom->_parse_single_config(item, level + 1);

return result;
} catch(const OptionNotFound &) {
return false;
}
}
// check for section open
if (item.name == "++" ) {
if (configurable_)
{
if(item.name == "++") {
if(configurable_) {
increment_parsed();
_trigger_pre_parse(2);
if (parent_ != nullptr)
{
if(parent_ != nullptr) {
parent_->parsed_subcommands_.push_back(this);
}
}
return true;
}
// check for section close
if(item.name=="--" ) {
if (configurable_)
{
if(item.name == "--") {
if(configurable_) {
_process_callbacks();
_process_requirements();
run_callback();
Expand Down
16 changes: 8 additions & 8 deletions tests/ConfigFileTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ TEST_F(TApp, IniLayeredDotSection) {
EXPECT_EQ(2, two);
EXPECT_EQ(3, three);

EXPECT_EQ(subcom->count(), 0);
EXPECT_EQ(subcom->count(), 0U);
EXPECT_FALSE(*subcom);
}

Expand Down Expand Up @@ -650,7 +650,7 @@ TEST_F(TApp, IniSubcommandConfigurable) {
EXPECT_EQ(2, two);
EXPECT_EQ(3, three);

EXPECT_EQ(subcom->count(), 1);
EXPECT_EQ(subcom->count(), 1U);
EXPECT_TRUE(*subcom);
EXPECT_TRUE(app.got_subcommand(subcom));
}
Expand Down Expand Up @@ -690,10 +690,10 @@ TEST_F(TApp, IniSubcommandConfigurablePreParse) {
EXPECT_EQ(3, three);
EXPECT_EQ(0, four);

EXPECT_EQ(parse_c.size(), 1u);
EXPECT_EQ(parse_c.size(), 1U);
EXPECT_EQ(parse_c[0], 2);

EXPECT_EQ(subcom2->count(), 0);
EXPECT_EQ(subcom2->count(), 0U);
}

TEST_F(TApp, IniSubcommandConfigurableParseComplete) {
Expand Down Expand Up @@ -1275,14 +1275,14 @@ TEST_F(TApp, IniOutputSubcomConfigurable) {
auto subcom = app.add_subcommand("other")->configurable();
subcom->add_flag("--newer");

args = { "--simple", "other", "--newer" };
args = {"--simple", "other", "--newer"};
run();

std::string str = app.config_to_str();
EXPECT_THAT(str, HasSubstr("simple=true"));
EXPECT_THAT(str, HasSubstr("[other]"));
EXPECT_THAT(str, HasSubstr("newer=true"));
EXPECT_EQ(str.find("other.newer=true"),std::string::npos);
EXPECT_EQ(str.find("other.newer=true"), std::string::npos);
}

TEST_F(TApp, IniOutputSubsubcom) {
Expand All @@ -1293,7 +1293,7 @@ TEST_F(TApp, IniOutputSubsubcom) {
auto subsubcom = subcom->add_subcommand("sub2");
subsubcom->add_flag("--newest");

args = { "--simple", "other", "--newer", "sub2", "--newest" };
args = {"--simple", "other", "--newer", "sub2", "--newest"};
run();

std::string str = app.config_to_str();
Expand All @@ -1311,7 +1311,7 @@ TEST_F(TApp, IniOutputSubsubcomConfigurable) {
auto subsubcom = subcom->add_subcommand("sub2");
subsubcom->add_flag("--newest");

args = { "--simple", "other", "--newer", "sub2", "--newest" };
args = {"--simple", "other", "--newer", "sub2", "--newest"};
run();

std::string str = app.config_to_str();
Expand Down

0 comments on commit 7a86355

Please sign in to comment.