aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2022-09-30 15:05:35 +0200
committerRyan Ofsky <ryan@ofsky.org>2022-12-09 10:03:26 -0500
commit293849a26088a16f6187dfdc36bef1d4d83ebb9d (patch)
treeb49d1b47a61a95a388098d519764aa748ef5a64b /src/test
parent16624e6ff3af4429e571f7a606bbbcac336e067a (diff)
downloadbitcoin-293849a26088a16f6187dfdc36bef1d4d83ebb9d.tar.xz
univalue: Remove confusing getBool method
Drop UniValue::getBool method because it is easy to confuse with the UniValue::get_bool method, and could potentially cause bugs. Unlike get_bool, getBool doesn't ensure that the value is a boolean and returns false for all integer, string, array, and object values instead of throwing an exceptions. The getBool method is also redundant because it is an alias for isTrue. There were only 5 getBool() calls in the codebase, so this commit replaces them with isTrue() or get_bool() calls as appropriate. These changes were originally made by MarcoFalke in https://github.com/bitcoin/bitcoin/pull/26213 but were dropped to limit the scope of that PR. Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/system_tests.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/system_tests.cpp b/src/test/system_tests.cpp
index d5b65b9c08..472b58b4d5 100644
--- a/src/test/system_tests.cpp
+++ b/src/test/system_tests.cpp
@@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE(run_command)
BOOST_CHECK(result.isObject());
const UniValue& success = find_value(result, "success");
BOOST_CHECK(!success.isNull());
- BOOST_CHECK_EQUAL(success.getBool(), true);
+ BOOST_CHECK_EQUAL(success.get_bool(), true);
}
{
// An invalid command is handled by Boost
@@ -95,7 +95,7 @@ BOOST_AUTO_TEST_CASE(run_command)
BOOST_CHECK(result.isObject());
const UniValue& success = find_value(result, "success");
BOOST_CHECK(!success.isNull());
- BOOST_CHECK_EQUAL(success.getBool(), true);
+ BOOST_CHECK_EQUAL(success.get_bool(), true);
}
#endif
}