diff options
author | fanquake <fanquake@gmail.com> | 2023-02-01 11:36:49 +0000 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-02-01 11:43:42 +0000 |
commit | 17acbc1a5a8d07ad30fc0ef4a726097f5cf9e168 (patch) | |
tree | 0d6ec693c011d235bf19888eb48df3adc550f496 /src/test/util/json.cpp | |
parent | e1bf5470f919cf212703466411968916db8ae61f (diff) | |
parent | 7a820cee0e6408f5848799011d82dd29ee7fa8c5 (diff) |
Merge bitcoin/bitcoin#25974: test, build: Separate `read_json` function into its own module
7a820cee0e6408f5848799011d82dd29ee7fa8c5 test, build: Separate `read_json` function into its own module (Hennadii Stepanov)
Pull request description:
Currently, 4 source files rely on the definition of the `read_json` function provided in `src/test/script_tests.cpp`.
This PR breaks this entanglement, improves code structure and maintainability.
ACKs for top commit:
fanquake:
ACK 7a820cee0e6408f5848799011d82dd29ee7fa8c5
Tree-SHA512: f1567989f76cb54ab86cc48927851a8c424b08a9483d02d4918b629e0c792108bad4ccf7fa341d57b0921d91e84bf8fa3b9c07e5fdf12c64d9d5da83e4e464fb
Diffstat (limited to 'src/test/util/json.cpp')
-rw-r--r-- | src/test/util/json.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/util/json.cpp b/src/test/util/json.cpp new file mode 100644 index 0000000000..ad3c346c84 --- /dev/null +++ b/src/test/util/json.cpp @@ -0,0 +1,17 @@ +// Copyright (c) 2023 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include <test/util/json.h> + +#include <string> +#include <util/check.h> + +#include <univalue.h> + +UniValue read_json(const std::string& jsondata) +{ + UniValue v; + Assert(v.read(jsondata) && v.isArray()); + return v.get_array(); +} |