diff options
author | Kiminuo <kiminuo@protonmail.com> | 2021-02-26 09:52:50 +0100 |
---|---|---|
committer | Kiminuo <kiminuo@protonmail.com> | 2021-04-18 11:59:25 +0200 |
commit | 1cb52ba0656e78ca6c2ef84b1558198ad113b76a (patch) | |
tree | 09df55afba0a82f42789dbf12ba3980bb673079b /src/test/util_tests.cpp | |
parent | 1add318704108faa98f5b1b8e9c96d960e9d23a8 (diff) |
Modify "util_datadir" unit test to not use gArgs.
Diffstat (limited to 'src/test/util_tests.cpp')
-rw-r--r-- | src/test/util_tests.cpp | 23 |
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) |