Skip to content

Commit 5b63a5c

Browse files
committed
test: use test framework init() instead of resetArgs()
1 parent bc6a562 commit 5b63a5c

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/qt/test/optiontests.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ OptionTests::OptionTests(interfaces::Node& node) : m_node(node)
2020
gArgs.LockSettings([&](util::Settings& s) { m_previous_settings = s; });
2121
}
2222

23-
void OptionTests::resetArgs()
23+
void OptionTests::init()
2424
{
25+
// reset args
2526
gArgs.LockSettings([&](util::Settings& s) { s = m_previous_settings; });
2627
gArgs.ClearPathCache();
2728
}
2829

2930
void OptionTests::migrateSettings()
3031
{
31-
resetArgs();
32-
3332
// Set legacy QSettings and verify that they get cleared and migrated to
3433
// settings.json
3534
QSettings settings;
@@ -73,8 +72,6 @@ void OptionTests::migrateSettings()
7372

7473
void OptionTests::integerGetArgBug()
7574
{
76-
resetArgs();
77-
7875
// Test regression https://github.com/bitcoin/bitcoin/issues/24457. Ensure
7976
// that setting integer prune value doesn't cause an exception to be thrown
8077
// in the OptionsModel constructor
@@ -93,8 +90,6 @@ void OptionTests::integerGetArgBug()
9390

9491
void OptionTests::parametersInteraction()
9592
{
96-
resetArgs();
97-
9893
// Test that the bug https://github.com/bitcoin-core/gui/issues/567 does not resurface.
9994
// It was fixed via https://github.com/bitcoin-core/gui/pull/568.
10095
// With fListen=false in ~/.config/Bitcoin/Bitcoin-Qt.conf and all else left as default,

src/qt/test/optiontests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class OptionTests : public QObject
1616
Q_OBJECT
1717
public:
1818
explicit OptionTests(interfaces::Node& node);
19-
void resetArgs();
2019

2120
private Q_SLOTS:
21+
void init(); // called before each test function execution.
2222
void migrateSettings();
2323
void integerGetArgBug();
2424
void parametersInteraction();

0 commit comments

Comments
 (0)