aboutsummaryrefslogtreecommitdiff
path: root/src/test/util_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/util_tests.cpp')
-rw-r--r--src/test/util_tests.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
index 76ffdc598a..a11716a7f1 100644
--- a/src/test/util_tests.cpp
+++ b/src/test/util_tests.cpp
@@ -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)