diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2022-12-02 17:37:08 -0500 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2022-12-02 17:37:08 -0500 |
commit | e2c3b18e671e347e422d696d1cbdd9f82b2ce468 (patch) | |
tree | 536d59876cda33e4b528d392157ddbd977dc69ff /src/test | |
parent | 78aee0fe2ca72e7bc0f36e7479574ebc1f6a9bee (diff) | |
download | bitcoin-e2c3b18e671e347e422d696d1cbdd9f82b2ce468.tar.xz |
test: Add RPC tests for same named parameter specified more than once
Current behavior isn't ideal and will be changed in upcoming commits, but it's
useful to have test coverage regardless.
MarcoFalke reported the case of bitcoin-cli positional arguments overwriting
the named "args" parameter in
https://github.com/bitcoin/bitcoin/pull/19762#discussion_r1035761471
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/rpc_tests.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index 21ccbe9648..23e666bc45 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -89,6 +89,9 @@ BOOST_AUTO_TEST_CASE(rpc_namedparams) // Make sure named arguments are transformed into positional arguments in correct places separated by nulls BOOST_CHECK_EQUAL(TransformParams(JSON(R"({"arg2": 2, "arg4": 4})"), arg_names).write(), "[null,2,null,4]"); + // Make sure later named argument value silently overwrites earlier values + BOOST_CHECK_EQUAL(TransformParams(JSON(R"({"arg2": 2, "arg2": 4})"), arg_names).write(), "[null,4]"); + // Make sure named and positional arguments can be combined. BOOST_CHECK_EQUAL(TransformParams(JSON(R"({"arg5": 5, "args": [1, 2], "arg4": 4})"), arg_names).write(), "[1,2,null,4,5]"); |