Commit 77624b71 authored by Volker Krause's avatar Volker Krause
Browse files

Improve failure diagnostic for ical generator unit test

parent ec44c4d9
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <QFile> #include <QFile>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
#include <QProcess>
#include <QObject> #include <QObject>
#include <QTest> #include <QTest>
...@@ -86,6 +87,16 @@ private Q_SLOTS: ...@@ -86,6 +87,16 @@ private Q_SLOTS:
if (*newEvent != *refEvent) { if (*newEvent != *refEvent) {
qDebug().noquote() << "Actual: " << format.toICalString(newEvent).remove(QLatin1Char('\r')); qDebug().noquote() << "Actual: " << format.toICalString(newEvent).remove(QLatin1Char('\r'));
qDebug().noquote() << "Expected: " << format.toICalString(refEvent).remove(QLatin1Char('\r')); qDebug().noquote() << "Expected: " << format.toICalString(refEvent).remove(QLatin1Char('\r'));
QFile failFile(icalFile + QLatin1String(".fail"));
QVERIFY(failFile.open(QFile::WriteOnly));
failFile.write(format.toICalString(newEvent).remove(QLatin1Char('\r')).toUtf8());
failFile.close();
QProcess proc;
proc.setProcessChannelMode(QProcess::ForwardedChannels);
proc.start(QStringLiteral("diff"), {QStringLiteral("-u"), icalFile, failFile.fileName()});
QVERIFY(proc.waitForFinished());
} }
QCOMPARE(newEvent->dtStart(), refEvent->dtStart()); QCOMPARE(newEvent->dtStart(), refEvent->dtStart());
......
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