Modify "util_datadir" unit test to not use gArgs.

pull/826/head
Kiminuo 4 years ago
parent 1add318704
commit 1cb52ba065

@ -49,24 +49,27 @@ BOOST_FIXTURE_TEST_SUITE(util_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(util_datadir)
{
ClearDatadirCache();
const fs::path dd_norm = GetDataDir();
// Use local args variable instead of m_args to avoid making assumptions about test setup
ArgsManager args;
args.ForceSetArg("-datadir", m_path_root.string());
const fs::path dd_norm = args.GetDataDirPath();
gArgs.ForceSetArg("-datadir", dd_norm.string() + "/");
args.ForceSetArg("-datadir", dd_norm.string() + "/");
ClearDatadirCache();
BOOST_CHECK_EQUAL(dd_norm, GetDataDir());
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath());
gArgs.ForceSetArg("-datadir", dd_norm.string() + "/.");
args.ForceSetArg("-datadir", dd_norm.string() + "/.");
ClearDatadirCache();
BOOST_CHECK_EQUAL(dd_norm, GetDataDir());
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath());
gArgs.ForceSetArg("-datadir", dd_norm.string() + "/./");
args.ForceSetArg("-datadir", dd_norm.string() + "/./");
ClearDatadirCache();
BOOST_CHECK_EQUAL(dd_norm, GetDataDir());
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath());
gArgs.ForceSetArg("-datadir", dd_norm.string() + "/.//");
args.ForceSetArg("-datadir", dd_norm.string() + "/.//");
ClearDatadirCache();
BOOST_CHECK_EQUAL(dd_norm, GetDataDir());
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath());
}
BOOST_AUTO_TEST_CASE(util_check)

Loading…
Cancel
Save