18
18
19
19
#include < boost/filesystem.hpp>
20
20
21
+ static UniValue rpcNestedTest_rpc (const JSONRPCRequest& request)
22
+ {
23
+ if (request.fHelp ) {
24
+ return " help message" ;
25
+ }
26
+ return request.params .write (0 , 0 );
27
+ }
28
+
29
+ static const CRPCCommand vRPCCommands[] =
30
+ {
31
+ { " test" , " rpcNestedTest" , &rpcNestedTest_rpc, true },
32
+ };
33
+
21
34
void RPCNestedTests::rpcNestedTests ()
22
35
{
23
36
UniValue jsonRPCError;
@@ -26,6 +39,7 @@ void RPCNestedTests::rpcNestedTests()
26
39
// could be moved to a more generic place when we add more tests on QT level
27
40
const CChainParams& chainparams = Params ();
28
41
RegisterAllCoreRPCCommands (tableRPC);
42
+ tableRPC.appendCommand (" rpcNestedTest" , &vRPCCommands[0 ]);
29
43
ClearDatadirCache ();
30
44
std::string path = QDir::tempPath ().toStdString () + " /" + strprintf (" test_bitcoin_qt_%lu_%i" , (unsigned long )GetTime (), (int )(GetRand (100000 )));
31
45
QDir dir (QString::fromStdString (path));
@@ -85,6 +99,23 @@ void RPCNestedTests::rpcNestedTests()
85
99
RPCConsole::RPCExecuteCommandLine (result, " getblock(getbestblockhash())[tx][0]" );
86
100
QVERIFY (result == " 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" );
87
101
102
+ RPCConsole::RPCExecuteCommandLine (result, " rpcNestedTest" );
103
+ QVERIFY (result == " []" );
104
+ RPCConsole::RPCExecuteCommandLine (result, " rpcNestedTest ''" );
105
+ QVERIFY (result == " [\"\" ]" );
106
+ RPCConsole::RPCExecuteCommandLine (result, " rpcNestedTest \"\" " );
107
+ QVERIFY (result == " [\"\" ]" );
108
+ RPCConsole::RPCExecuteCommandLine (result, " rpcNestedTest '' abc" );
109
+ QVERIFY (result == " [\"\" ,\" abc\" ]" );
110
+ RPCConsole::RPCExecuteCommandLine (result, " rpcNestedTest abc '' abc" );
111
+ QVERIFY (result == " [\" abc\" ,\"\" ,\" abc\" ]" );
112
+ RPCConsole::RPCExecuteCommandLine (result, " rpcNestedTest abc abc" );
113
+ QVERIFY (result == " [\" abc\" ,\" abc\" ]" );
114
+ RPCConsole::RPCExecuteCommandLine (result, " rpcNestedTest abc\t\t abc" );
115
+ QVERIFY (result == " [\" abc\" ,\" abc\" ]" );
116
+ RPCConsole::RPCExecuteCommandLine (result, " rpcNestedTest abc,,abc" );
117
+ QVERIFY (result == " [\" abc\" ,\"\" ,\" abc\" ]" );
118
+
88
119
delete pcoinsTip;
89
120
delete pcoinsdbview;
90
121
delete pblocktree;
0 commit comments