aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarol Rodriguez <jarolrod@tutanota.com>2021-05-16 20:36:59 -0400
committerJarol Rodriguez <jarolrod@tutanota.com>2021-06-01 02:07:54 -0400
commitd09d1cf1a267b1c5563d8876aa55c4e8f70f0562 (patch)
tree73b9d11bdb6fc5eba0b02b3b1b53106188ba05bf
parent62d9ff9e6e1e136eef6f09f05e1d624f53641827 (diff)
qt, test: introduce FindInConsole function
Allows for regex searching into the console output.
-rw-r--r--src/qt/test/apptests.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp
index cb3dbd2267..c5f9b570a1 100644
--- a/src/qt/test/apptests.cpp
+++ b/src/qt/test/apptests.cpp
@@ -21,6 +21,7 @@
#include <QAction>
#include <QLineEdit>
+#include <QRegularExpression>
#include <QScopedPointer>
#include <QSignalSpy>
#include <QTest>
@@ -30,6 +31,13 @@
#include <QtTest/QtTestGui>
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.
void TestRpcCommand(RPCConsole* console)
{