aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-06-03 12:14:33 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-06-04 11:08:00 +0200
commitfa910b47656d0e69cccb1f31804f2b11aa45d053 (patch)
tree5d2084e49b3408554a4cdf5c856b9c3330170705 /src/test
parenta9435e34457e0bfebd22e574fe63428537948aeb (diff)
util: Properly handle -noincludeconf on command line
This bug was introduced in commit fad0867d6ab9430070aa7d60bf7617a6508e0586. Unit test Co-Authored-By: Russell Yanofsky <russ@yanofsky.org>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/util_tests.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
index d463bcdd8e..7ce38519cf 100644
--- a/src/test/util_tests.cpp
+++ b/src/test/util_tests.cpp
@@ -329,6 +329,25 @@ BOOST_FIXTURE_TEST_CASE(util_CheckValue, CheckValueTest)
CheckValue(M::ALLOW_ANY, "-value=abc", Expect{"abc"}.String("abc").Int(0).Bool(false).List({"abc"}));
}
+struct NoIncludeConfTest {
+ std::string Parse(const char* arg)
+ {
+ TestArgsManager test;
+ test.SetupArgs({{"-includeconf", ArgsManager::ALLOW_ANY}});
+ std::array argv{"ignored", arg};
+ std::string error;
+ (void)test.ParseParameters(argv.size(), argv.data(), error);
+ return error;
+ }
+};
+
+BOOST_FIXTURE_TEST_CASE(util_NoIncludeConf, NoIncludeConfTest)
+{
+ BOOST_CHECK_EQUAL(Parse("-noincludeconf"), "");
+ BOOST_CHECK_EQUAL(Parse("-includeconf"), "-includeconf cannot be used from commandline; -includeconf=\"\"");
+ BOOST_CHECK_EQUAL(Parse("-includeconf=file"), "-includeconf cannot be used from commandline; -includeconf=\"file\"");
+}
+
BOOST_AUTO_TEST_CASE(util_ParseParameters)
{
TestArgsManager testArgs;