diff options
-rw-r--r-- | src/qt/test/optiontests.cpp | 8 | ||||
-rw-r--r-- | src/test/getarg_tests.cpp | 6 | ||||
-rw-r--r-- | src/util/system.cpp | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/qt/test/optiontests.cpp b/src/qt/test/optiontests.cpp index 80d8d77984..51894e1915 100644 --- a/src/qt/test/optiontests.cpp +++ b/src/qt/test/optiontests.cpp @@ -15,15 +15,15 @@ //! Entry point for BitcoinApplication tests. void OptionTests::optionTests() { - // Test regression https://github.com/bitcoin/bitcoin/issues/24457. Check - // if setting an integer prune value causes an exception to be thrown in - // the OptionsModel constructor. + // Test regression https://github.com/bitcoin/bitcoin/issues/24457. Ensure + // that setting integer prune value doesn't cause an exception to be thrown + // in the OptionsModel constructor gArgs.LockSettings([&](util::Settings& settings) { settings.forced_settings.erase("prune"); settings.rw_settings["prune"] = 3814; }); gArgs.WriteSettingsFile(); - QVERIFY_EXCEPTION_THROWN(OptionsModel{}, std::runtime_error); + OptionsModel{}; gArgs.LockSettings([&](util::Settings& settings) { settings.rw_settings.erase("prune"); }); diff --git a/src/test/getarg_tests.cpp b/src/test/getarg_tests.cpp index 56eca24cd4..32edeb47f3 100644 --- a/src/test/getarg_tests.cpp +++ b/src/test/getarg_tests.cpp @@ -98,21 +98,21 @@ BOOST_AUTO_TEST_CASE(setting_args) set_foo(99); BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "99"); - BOOST_CHECK_THROW(args.GetArg("foo", "default"), std::runtime_error); + BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "99"); BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 99); BOOST_CHECK_THROW(args.GetBoolArg("foo", true), std::runtime_error); BOOST_CHECK_THROW(args.GetBoolArg("foo", false), std::runtime_error); set_foo(3.25); BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "3.25"); - BOOST_CHECK_THROW(args.GetArg("foo", "default"), std::runtime_error); + BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "3.25"); BOOST_CHECK_THROW(args.GetIntArg("foo", 100), std::runtime_error); BOOST_CHECK_THROW(args.GetBoolArg("foo", true), std::runtime_error); BOOST_CHECK_THROW(args.GetBoolArg("foo", false), std::runtime_error); set_foo(0); BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "0"); - BOOST_CHECK_THROW(args.GetArg("foo", "default"), std::runtime_error); + BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "0"); BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 0); BOOST_CHECK_THROW(args.GetBoolArg("foo", true), std::runtime_error); BOOST_CHECK_THROW(args.GetBoolArg("foo", false), std::runtime_error); diff --git a/src/util/system.cpp b/src/util/system.cpp index aa9122106b..b5915335c5 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -588,7 +588,7 @@ bool ArgsManager::IsArgNegated(const std::string& strArg) const std::string ArgsManager::GetArg(const std::string& strArg, const std::string& strDefault) const { const util::SettingsValue value = GetSetting(strArg); - return value.isNull() ? strDefault : value.isFalse() ? "0" : value.isTrue() ? "1" : value.get_str(); + return value.isNull() ? strDefault : value.isFalse() ? "0" : value.isTrue() ? "1" : value.isNum() ? value.getValStr() : value.get_str(); } int64_t ArgsManager::GetIntArg(const std::string& strArg, int64_t nDefault) const |