Skip to content

Commit 6526a16

Browse files
committed
test: small cleanup in RPCNestedTests tests
Add missing includes. Remove obsolete comment about Qt 5.3 (fd46c4c)
1 parent e4a2918 commit 6526a16

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/qt/test/rpcnestedtests.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
#include <univalue.h>
1212
#include <util/system.h>
1313

14-
#include <QDir>
15-
#include <QtGlobal>
14+
#include <QTest>
15+
16+
#include <string>
17+
#include <stdexcept>
1618

1719
static RPCHelpMan rpcNestedTest_rpc()
1820
{
@@ -26,7 +28,7 @@ static RPCHelpMan rpcNestedTest_rpc()
2628
},
2729
{},
2830
RPCExamples{""},
29-
[](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue {
31+
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue {
3032
return request.params.write(0, 0);
3133
},
3234
};
@@ -68,13 +70,13 @@ void RPCNestedTests::rpcNestedTests()
6870
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo "); //whitespace at the end will be tolerated
6971
QVERIFY(result.substr(0,1) == "{");
7072

71-
(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()[\"chain\"]")); //Quote path identifier are allowed, but look after a child containing the quotes in the key
73+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()[\"chain\"]"); //Quote path identifier are allowed, but look after a child containing the quotes in the key
7274
QVERIFY(result == "null");
7375

74-
(RPCConsole::RPCExecuteCommandLine(m_node, result, "createrawtransaction [] {} 0")); //parameter not in brackets are allowed
75-
(RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction([],{},0)")); //parameter in brackets are allowed
76+
RPCConsole::RPCExecuteCommandLine(m_node, result, "createrawtransaction [] {} 0"); //parameter not in brackets are allowed
77+
RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction([],{},0)"); //parameter in brackets are allowed
7678
QVERIFY(result == result2);
77-
(RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction( [], {} , 0 )")); //whitespace between parameters is allowed
79+
RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction( [], {} , 0 )"); //whitespace between parameters is allowed
7880
QVERIFY(result == result2);
7981

8082
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblock(getbestblockhash())[tx][0]", &filtered);
@@ -123,11 +125,10 @@ void RPCNestedTests::rpcNestedTests()
123125
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest( abc , cba )");
124126
QVERIFY(result == "[\"abc\",\"cba\"]");
125127

126-
// do the QVERIFY_EXCEPTION_THROWN checks only with Qt5.3 and higher (QVERIFY_EXCEPTION_THROWN was introduced in Qt5.3)
127128
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() .\n"), std::runtime_error); //invalid syntax
128129
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() getblockchaininfo()"), std::runtime_error); //invalid syntax
129-
(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo(")); //tolerate non closing brackets if we have no arguments
130-
(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()()()")); //tolerate non command brackets
130+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo("); //tolerate non closing brackets if we have no arguments
131+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()()()"); //tolerate non command brackets
131132
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo(True)"), UniValue); //invalid argument
132133
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "a(getblockchaininfo(True))"), UniValue); //method not found
133134
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest abc,,abc"), std::runtime_error); //don't tolerate empty arguments when using ,

0 commit comments

Comments
 (0)