scripted-diff: Remove unused ArgsManager type flags in tests

The bool/int/string flags were added speculatively in #16097 and trigger errors
when type checking is actually implemented in
https://github.com/bitcoin/bitcoin/pull/16545

-BEGIN VERIFY SCRIPT-
sed -i 's/ALLOW_\(BOOL\|INT\|STRING\)/ALLOW_ANY/g' src/test/util_tests.cpp src/test/getarg_tests.cpp
-END VERIFY SCRIPT-

This commit does not change behavior.
pull/764/head
Russell Yanofsky 5 years ago
parent 425bb30725
commit cba2710220

@ -43,7 +43,7 @@ static void SetupArgs(const std::vector<std::pair<std::string, unsigned int>>& a
BOOST_AUTO_TEST_CASE(boolarg)
{
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_BOOL);
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_ANY);
SetupArgs({foo});
ResetArgs("-foo");
BOOST_CHECK(gArgs.GetBoolArg("-foo", false));
@ -97,8 +97,8 @@ BOOST_AUTO_TEST_CASE(boolarg)
BOOST_AUTO_TEST_CASE(stringarg)
{
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_STRING);
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_STRING);
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_ANY);
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_ANY);
SetupArgs({foo, bar});
ResetArgs("");
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", ""), "");
@ -124,8 +124,8 @@ BOOST_AUTO_TEST_CASE(stringarg)
BOOST_AUTO_TEST_CASE(intarg)
{
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_INT);
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_INT);
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_ANY);
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_ANY);
SetupArgs({foo, bar});
ResetArgs("");
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", 11), 11);
@ -159,8 +159,8 @@ BOOST_AUTO_TEST_CASE(doubledash)
BOOST_AUTO_TEST_CASE(boolargno)
{
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_BOOL);
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_BOOL);
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_ANY);
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_ANY);
SetupArgs({foo, bar});
ResetArgs("-nofoo");
BOOST_CHECK(!gArgs.GetBoolArg("-foo", true));

@ -397,12 +397,12 @@ BOOST_AUTO_TEST_CASE(util_ArgParsing)
BOOST_AUTO_TEST_CASE(util_GetBoolArg)
{
TestArgsManager testArgs;
const auto a = std::make_pair("-a", ArgsManager::ALLOW_BOOL);
const auto b = std::make_pair("-b", ArgsManager::ALLOW_BOOL);
const auto c = std::make_pair("-c", ArgsManager::ALLOW_BOOL);
const auto d = std::make_pair("-d", ArgsManager::ALLOW_BOOL);
const auto e = std::make_pair("-e", ArgsManager::ALLOW_BOOL);
const auto f = std::make_pair("-f", ArgsManager::ALLOW_BOOL);
const auto a = std::make_pair("-a", ArgsManager::ALLOW_ANY);
const auto b = std::make_pair("-b", ArgsManager::ALLOW_ANY);
const auto c = std::make_pair("-c", ArgsManager::ALLOW_ANY);
const auto d = std::make_pair("-d", ArgsManager::ALLOW_ANY);
const auto e = std::make_pair("-e", ArgsManager::ALLOW_ANY);
const auto f = std::make_pair("-f", ArgsManager::ALLOW_ANY);
const char *argv_test[] = {
"ignored", "-a", "-nob", "-c=0", "-d=1", "-e=false", "-f=true"};
@ -441,8 +441,8 @@ BOOST_AUTO_TEST_CASE(util_GetBoolArgEdgeCases)
TestArgsManager testArgs;
// Params test
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_BOOL);
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_BOOL);
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_ANY);
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_ANY);
const char *argv_test[] = {"ignored", "-nofoo", "-foo", "-nobar=0"};
testArgs.SetupArgs({foo, bar});
std::string error;
@ -514,16 +514,16 @@ BOOST_AUTO_TEST_CASE(util_ReadConfigStream)
TestArgsManager test_args;
LOCK(test_args.cs_args);
const auto a = std::make_pair("-a", ArgsManager::ALLOW_BOOL);
const auto b = std::make_pair("-b", ArgsManager::ALLOW_BOOL);
const auto ccc = std::make_pair("-ccc", ArgsManager::ALLOW_STRING);
const auto d = std::make_pair("-d", ArgsManager::ALLOW_STRING);
const auto a = std::make_pair("-a", ArgsManager::ALLOW_ANY);
const auto b = std::make_pair("-b", ArgsManager::ALLOW_ANY);
const auto ccc = std::make_pair("-ccc", ArgsManager::ALLOW_ANY);
const auto d = std::make_pair("-d", ArgsManager::ALLOW_ANY);
const auto e = std::make_pair("-e", ArgsManager::ALLOW_ANY);
const auto fff = std::make_pair("-fff", ArgsManager::ALLOW_BOOL);
const auto ggg = std::make_pair("-ggg", ArgsManager::ALLOW_BOOL);
const auto h = std::make_pair("-h", ArgsManager::ALLOW_BOOL);
const auto i = std::make_pair("-i", ArgsManager::ALLOW_BOOL);
const auto iii = std::make_pair("-iii", ArgsManager::ALLOW_INT);
const auto fff = std::make_pair("-fff", ArgsManager::ALLOW_ANY);
const auto ggg = std::make_pair("-ggg", ArgsManager::ALLOW_ANY);
const auto h = std::make_pair("-h", ArgsManager::ALLOW_ANY);
const auto i = std::make_pair("-i", ArgsManager::ALLOW_ANY);
const auto iii = std::make_pair("-iii", ArgsManager::ALLOW_ANY);
test_args.SetupArgs({a, b, ccc, d, e, fff, ggg, h, i, iii});
test_args.ReadConfigString(str_config);
@ -726,8 +726,8 @@ BOOST_AUTO_TEST_CASE(util_GetArg)
BOOST_AUTO_TEST_CASE(util_GetChainName)
{
TestArgsManager test_args;
const auto testnet = std::make_pair("-testnet", ArgsManager::ALLOW_BOOL);
const auto regtest = std::make_pair("-regtest", ArgsManager::ALLOW_BOOL);
const auto testnet = std::make_pair("-testnet", ArgsManager::ALLOW_ANY);
const auto regtest = std::make_pair("-regtest", ArgsManager::ALLOW_ANY);
test_args.SetupArgs({testnet, regtest});
const char* argv_testnet[] = {"cmd", "-testnet"};

Loading…
Cancel
Save