[Qt] Console: allow empty arguments #9329

Merged
merged 3 commits into from Dec 19, 2016

Projects

None yet

3 participants

@jonasschnelli
Member

Should fix #9210 and re-allow empty arguments like command '' <more arg...> or command "" <more args...>.

@jonasschnelli jonasschnelli added the GUI label Dec 12, 2016
@luke-jr
Member
luke-jr commented Dec 12, 2016

Maybe add a unit test to check this case?

@luke-jr
Member
luke-jr commented Dec 12, 2016 edited

This doesn't appear to actually fix the problem at all: luke-jr@3710cf3

jonasschnelli and others added some commits Dec 12, 2016
@jonasschnelli jonasschnelli [Qt] Console: allow empty arguments 89c8d2c
@luke-jr @jonasschnelli luke-jr Qt/Test: Check handling of empty arguments in RPC debug console 6a32c0f
@jonasschnelli
Member

Added @luke-jr's unit test, added some more fixes.

@luke-jr
Member
luke-jr commented Dec 13, 2016

Here's a few more, including one that fails:

    RPCConsole::RPCExecuteCommandLine(result, "rpcNestedTest(abc,,abc)");
    QVERIFY(result == "[\"abc\",\"\",\"abc\"]");
    RPCConsole::RPCExecuteCommandLine(result, "rpcNestedTest(abc,,)");  // this one fails
    QVERIFY(result == "[\"abc\",\"\",\"\"]");
    RPCConsole::RPCExecuteCommandLine(result, "rpcNestedTest(abc )");
    QVERIFY(result == "[\"abc\"]");
    RPCConsole::RPCExecuteCommandLine(result, "rpcNestedTest( abc)");
    QVERIFY(result == "[\"abc\"]");
@jonasschnelli jonasschnelli [Qt] Console: don't allow empty arguments when using the comma-syntax 390bd14
@jonasschnelli
Member

Added more rules and tests.
Now, empty arguments are no longer supported when using the comma-syntax.
Examples

  • [NOK] command <arg0>,,<arg2>
  • [OK] command <arg0>,"",<arg2>
  • [NOK] command(<arg0>,,<arg2>)
  • [NOK] command(<arg0>,)
  • [OK] command <arg0> "" <arg2>
  • [OK] command( <arg0> , <arg2> )
@laanwj
Member
laanwj commented Dec 15, 2016

Now, empty arguments are no longer supported when using the comma-syntax.

Makes sense, I think.
Thanks for adding tests :)
code-review-ACK 413ce40

@laanwj laanwj self-requested a review Dec 15, 2016
@laanwj
laanwj approved these changes Dec 15, 2016 View changes
@laanwj laanwj merged commit 390bd14 into bitcoin:master Dec 19, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@laanwj laanwj added a commit that referenced this pull request Dec 19, 2016
@laanwj laanwj Merge #9329: [Qt] Console: allow empty arguments
390bd14 [Qt] Console: don't allow empty arguments when using the comma-syntax (Jonas Schnelli)
6a32c0f Qt/Test: Check handling of empty arguments in RPC debug console (Luke Dashjr)
89c8d2c [Qt] Console: allow empty arguments (Jonas Schnelli)
db45ad8
@luke-jr luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Dec 21, 2016
@jonasschnelli @luke-jr jonasschnelli + luke-jr [Qt] Console: allow empty arguments
Github-Pull: #9329
Rebased-From: 89c8d2c
d63d8ab
@luke-jr luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Dec 21, 2016
@luke-jr luke-jr Qt/Test: Check handling of empty arguments in RPC debug console
Github-Pull: #9329
Rebased-From: 6a32c0f
4fce7fc
@luke-jr luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Dec 21, 2016
@jonasschnelli @luke-jr jonasschnelli + luke-jr [Qt] Console: don't allow empty arguments when using the comma-syntax
Github-Pull: #9329
Rebased-From: 390bd14
93bef63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment