Skip to content

Commit d09d1cf

Browse files
committed
qt, test: introduce FindInConsole function
Allows for regex searching into the console output.
1 parent 62d9ff9 commit d09d1cf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/qt/test/apptests.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include <QAction>
2323
#include <QLineEdit>
24+
#include <QRegularExpression>
2425
#include <QScopedPointer>
2526
#include <QSignalSpy>
2627
#include <QTest>
@@ -30,6 +31,13 @@
3031
#include <QtTest/QtTestGui>
3132

3233
namespace {
34+
//! Regex find a string group inside of the console output
35+
QString FindInConsole(const QString& output, const QString& pattern)
36+
{
37+
const QRegularExpression re(pattern);
38+
return re.match(output).captured(1);
39+
}
40+
3341
//! Call getblockchaininfo RPC and check first field of JSON output.
3442
void TestRpcCommand(RPCConsole* console)
3543
{

0 commit comments

Comments
 (0)