From 6969b2bb98a2f44e1b51c905db92ec2e28345078 Mon Sep 17 00:00:00 2001 From: Jarol Rodriguez Date: Sun, 16 May 2021 23:43:41 -0400 Subject: qt, test: use regex search in apptests use the FindInConsole function to regex search for values in apptests instead of Univalue read. --- src/qt/test/apptests.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/qt/test') diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp index c5f9b570a1..318a0edf6e 100644 --- a/src/qt/test/apptests.cpp +++ b/src/qt/test/apptests.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #if defined(HAVE_CONFIG_H) @@ -24,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -49,10 +49,9 @@ void TestRpcCommand(RPCConsole* console) QTest::keyClick(lineEdit, Qt::Key_Return); QVERIFY(mw_spy.wait(1000)); QCOMPARE(mw_spy.count(), 4); - QString output = messagesWidget->toPlainText(); - UniValue value; - value.read(output.right(output.size() - output.lastIndexOf(QChar::ObjectReplacementCharacter) - 1).toStdString()); - QCOMPARE(value["chain"].get_str(), std::string("regtest")); + const QString output = messagesWidget->toPlainText(); + const QString pattern = QStringLiteral("\"chain\": \"(\\w+)\""); + QCOMPARE(FindInConsole(output, pattern), QString("regtest")); } } // namespace -- cgit v1.2.3