Skip to content

Commit d32b704

Browse files
committed
qt, test: use regex search in apptests
use the FindInConsole function to regex search for values in apptests instead of Univalue read.
1 parent 2c679ec commit d32b704

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/qt/test/apptests.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <qt/rpcconsole.h>
1313
#include <shutdown.h>
1414
#include <test/util/setup_common.h>
15-
#include <univalue.h>
1615
#include <validation.h>
1716

1817
#if defined(HAVE_CONFIG_H)
@@ -48,10 +47,9 @@ void TestRpcCommand(RPCConsole* console)
4847
QTest::keyClicks(lineEdit, "getblockchaininfo");
4948
QTest::keyClick(lineEdit, Qt::Key_Return);
5049
loop.exec();
51-
QString output = messagesWidget->toPlainText();
52-
UniValue value;
53-
value.read(output.right(output.size() - output.lastIndexOf(QChar::ObjectReplacementCharacter) - 1).toStdString());
54-
QCOMPARE(value["chain"].get_str(), std::string("regtest"));
50+
const QString output = messagesWidget->toPlainText();
51+
const QString pattern = "\"chain\": \"(\\w+)\"";
52+
QCOMPARE(FindInConsole(output, pattern), "regtest");
5553
}
5654
} // namespace
5755

0 commit comments

Comments
 (0)