diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index cd9804ed..d5065772 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -826,7 +826,6 @@ protected: detail::ini_ret_t& current = args.back(); std::string parent = current.parent(); // respects curent.level std::string name = current.name(); - std::cout << current.fullname << " " << parent << " " << name << std::endl; // If a parent is listed, go to a subcommand if(parent != "") { diff --git a/tests/IniTest.cpp b/tests/IniTest.cpp index d97ea725..5efe20aa 100644 --- a/tests/IniTest.cpp +++ b/tests/IniTest.cpp @@ -325,6 +325,69 @@ TEST_F(TApp, IniLayered) { } +TEST_F(TApp, IniFailure) { + + TempFile tmpini{"TestIniTmp.ini"}; + + app.add_config("--config", tmpini); + + { + std::ofstream out{tmpini}; + out << "[default]" << std::endl; + out << "val=1" << std::endl; + } + + EXPECT_THROW(run(), CLI::ExtrasINIError); +} + + +TEST_F(TApp, IniSubFailure) { + + TempFile tmpini{"TestIniTmp.ini"}; + + auto sub = app.add_subcommand("other"); + app.add_config("--config", tmpini); + + { + std::ofstream out{tmpini}; + out << "[other]" << std::endl; + out << "val=1" << std::endl; + } + + EXPECT_THROW(run(), CLI::ExtrasINIError); +} + + +TEST_F(TApp, IniNoSubFailure) { + + TempFile tmpini{"TestIniTmp.ini"}; + + app.add_config("--config", tmpini); + + { + std::ofstream out{tmpini}; + out << "[other]" << std::endl; + out << "val=1" << std::endl; + } + + EXPECT_THROW(run(), CLI::ExtrasINIError); +} + +TEST_F(TApp, IniFlagConvertFailure) { + + TempFile tmpini{"TestIniTmp.ini"}; + + app.add_flag("--flag"); + app.add_config("--config", tmpini); + + { + std::ofstream out{tmpini}; + out << "flag=moobook" << std::endl; + } + + EXPECT_THROW(run(), CLI::ConversionError); +} + TEST_F(TApp, IniFlags) { TempFile tmpini{"TestIniTmp.ini"}; app.add_config("--config", tmpini);