0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00

qt, test: introduce FindInConsole function

Allows for regex searching into the console output.
This commit is contained in:
Jarol Rodriguez 2021-05-16 20:36:59 -04:00
parent 62d9ff9e6e
commit d09d1cf1a2

View file

@ -21,6 +21,7 @@
#include <QAction> #include <QAction>
#include <QLineEdit> #include <QLineEdit>
#include <QRegularExpression>
#include <QScopedPointer> #include <QScopedPointer>
#include <QSignalSpy> #include <QSignalSpy>
#include <QTest> #include <QTest>
@ -30,6 +31,13 @@
#include <QtTest/QtTestGui> #include <QtTest/QtTestGui>
namespace { namespace {
//! Regex find a string group inside of the console output
QString FindInConsole(const QString& output, const QString& pattern)
{
const QRegularExpression re(pattern);
return re.match(output).captured(1);
}
//! Call getblockchaininfo RPC and check first field of JSON output. //! Call getblockchaininfo RPC and check first field of JSON output.
void TestRpcCommand(RPCConsole* console) void TestRpcCommand(RPCConsole* console)
{ {