aboutsummaryrefslogtreecommitdiff
path: root/src/qt/test/apptests.cpp
diff options
context:
space:
mode:
authorJarol Rodriguez <jarolrod@tutanota.com>2021-05-16 23:43:41 -0400
committerJarol Rodriguez <jarolrod@tutanota.com>2021-06-01 02:10:18 -0400
commit6969b2bb98a2f44e1b51c905db92ec2e28345078 (patch)
treea75e5864f7ec56bb25f1e586d07d09682ec7c361 /src/qt/test/apptests.cpp
parentd09d1cf1a267b1c5563d8876aa55c4e8f70f0562 (diff)
qt, test: use regex search in apptests
use the FindInConsole function to regex search for values in apptests instead of Univalue read.
Diffstat (limited to 'src/qt/test/apptests.cpp')
-rw-r--r--src/qt/test/apptests.cpp9
1 files changed, 4 insertions, 5 deletions
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 <qt/rpcconsole.h>
#include <shutdown.h>
#include <test/util/setup_common.h>
-#include <univalue.h>
#include <validation.h>
#if defined(HAVE_CONFIG_H)
@@ -24,6 +23,7 @@
#include <QRegularExpression>
#include <QScopedPointer>
#include <QSignalSpy>
+#include <QString>
#include <QTest>
#include <QTextEdit>
#include <QtGlobal>
@@ -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