mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-31 14:32:35 +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 <qt/rpcconsole.h>
|
||||||
#include <shutdown.h>
|
#include <shutdown.h>
|
||||||
#include <test/util/setup_common.h>
|
#include <test/util/setup_common.h>
|
||||||
#include <univalue.h>
|
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
|
||||||
#if defined(HAVE_CONFIG_H)
|
#if defined(HAVE_CONFIG_H)
|
||||||
@ -24,6 +23,7 @@
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QSignalSpy>
|
#include <QSignalSpy>
|
||||||
|
#include <QString>
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
@ -49,10 +49,9 @@ void TestRpcCommand(RPCConsole* console)
|
|||||||
QTest::keyClick(lineEdit, Qt::Key_Return);
|
QTest::keyClick(lineEdit, Qt::Key_Return);
|
||||||
QVERIFY(mw_spy.wait(1000));
|
QVERIFY(mw_spy.wait(1000));
|
||||||
QCOMPARE(mw_spy.count(), 4);
|
QCOMPARE(mw_spy.count(), 4);
|
||||||
QString output = messagesWidget->toPlainText();
|
const QString output = messagesWidget->toPlainText();
|
||||||
UniValue value;
|
const QString pattern = QStringLiteral("\"chain\": \"(\\w+)\"");
|
||||||
value.read(output.right(output.size() - output.lastIndexOf(QChar::ObjectReplacementCharacter) - 1).toStdString());
|
QCOMPARE(FindInConsole(output, pattern), QString("regtest"));
|
||||||
QCOMPARE(value["chain"].get_str(), std::string("regtest"));
|
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user