mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-29 13:32:33 +02:00
qt, test: use regex search in apptests
use the FindInConsole function to regex search for values in apptests instead of Univalue read.
This commit is contained in:
parent
d09d1cf1a2
commit
6969b2bb98
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user