Commit 4b3d8e82 authored by Erik Verbruggen's avatar Erik Verbruggen

C++ tests: increase verbosity to simplify debugging.

Change-Id: Ib92418898d627b9b07b861a0255684c8f925f814
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent a63ed31b
......@@ -78,9 +78,11 @@ ResultData::ResultDataList ResultData::fromFilterEntryList(const QList<LocatorFi
return result;
}
void ResultData::printFilterEntries(const ResultData::ResultDataList &entries)
void ResultData::printFilterEntries(const ResultData::ResultDataList &entries, const QString &msg)
{
QTextStream out(stdout);
if (!msg.isEmpty())
out << msg << endl;
foreach (const ResultData entry, entries) {
out << "<< ResultData(_(\"" << entry.textColumn1 << "\"), _(\"" << entry.textColumn2
<< "\"))" << endl;
......
......@@ -66,7 +66,7 @@ public:
static ResultDataList fromFilterEntryList(const QList<LocatorFilterEntry> &entries);
/// For debugging and creating reference data
static void printFilterEntries(const ResultDataList &entries);
static void printFilterEntries(const ResultDataList &entries, const QString &msg = QString());
QString textColumn1;
QString textColumn2;
......
......@@ -56,6 +56,8 @@ Q_DECLARE_METATYPE(ILocatorFilter *)
namespace {
enum { debug = 0 };
QTC_DECLARE_MYTESTDATADIR("../../../tests/cpplocators/")
inline QString _(const QByteArray &ba) { return QString::fromLatin1(ba, ba.size()); }
......@@ -77,7 +79,10 @@ public:
QVERIFY(garbageCollectGlobalSnapshot());
ResultDataList results = ResultData::fromFilterEntryList(matchesFor(searchText));
// ResultData::printFilterEntries(results);
if (debug) {
ResultData::printFilterEntries(expectedResults, QLatin1String("Expected:"));
ResultData::printFilterEntries(results, QLatin1String("Results:"));
}
QVERIFY(!results.isEmpty());
QCOMPARE(results, expectedResults);
}
......@@ -105,7 +110,10 @@ public:
QVERIFY(!m_fileName.isEmpty());
ResultDataList results = ResultData::fromFilterEntryList(matchesFor());
// ResultData::printFilterEntries(results);
if (debug) {
ResultData::printFilterEntries(expectedResults, QLatin1String("Expected:"));
ResultData::printFilterEntries(results, QLatin1String("Results:"));
}
QVERIFY(!results.isEmpty());
QCOMPARE(results, expectedResults);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment