From 194284c24b37c7132b3e871fa1787878a19caec3 Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Thu, 16 Mar 2017 22:10:11 -0400 Subject: [PATCH] Adding remove_option check on config --- tests/IniTest.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/IniTest.cpp b/tests/IniTest.cpp index 38835865..af0b371a 100644 --- a/tests/IniTest.cpp +++ b/tests/IniTest.cpp @@ -208,6 +208,28 @@ TEST_F(TApp, IniRequiredNotFound) { } +TEST_F(TApp, IniOverwrite) { + + TempFile tmpini{"TestIniTmp.ini"}; + { + std::ofstream out{tmpini}; + out << "[default]" << std::endl; + out << "two=99" << std::endl; + } + + std::string orig = "filename_not_exist.ini"; + std::string next = "TestIniTmp.ini"; + app.add_config("--config", orig); + // Make sure this can be overwritten + app.add_config("--conf", next); + int two = 7; + app.add_option("--two", two); + + run(); + + EXPECT_EQ(99, two); +} + TEST_F(TApp, IniRequired) { TempFile tmpini{"TestIniTmp.ini"};