Commit 4bd33a1b authored by Volker Krause's avatar Volker Krause

Don't use pointers to destroyed temporaries here.

(cherry picked from commit 672dd71a)
parent c99b4ab4
......@@ -29,29 +29,29 @@ QTEST_MAIN(ParseDateTimeTest)
void ParseDateTimeTest::testParseDateTime_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<QByteArray>("input");
QTest::addColumn<QDateTime>("expResult");
QTest::newRow("1") << QStringLiteral("Sat, 25 Apr 2015 12:10:48 +0000") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-25T12:10:48+00:00"), Qt::ISODate));
QTest::newRow("2") << QStringLiteral("Fri, 24 Apr 2015 10:22:42 +0200") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-24T10:22:42+02:00"), Qt::ISODate));
QTest::newRow("3") << QStringLiteral("Thu, 23 Apr 2015 21:43:32 -0300") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-23T21:43:32-03:00"), Qt::ISODate));
QTest::newRow("4") << QStringLiteral("Fri 24 Apr 2015 10:39:15 +0200") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-24T10:39:15+02:00"), Qt::ISODate));
QTest::newRow("5") << QStringLiteral("Fri 24 Apr 2015 10:39:15 +02:00") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-24T10:39:15+02:00"), Qt::ISODate));
QTest::newRow("6") << QStringLiteral("Fri 24 Apr 2015 10:39:15 +02:23") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-24T10:39:15+02:23"), Qt::ISODate));
QTest::newRow("7") << QStringLiteral("Fri 24 Apr 2015 10:39:15 +02a") << QDateTime();
QTest::newRow("8") << QStringLiteral("Fri 24 Apr 2015 10:39:15 +02:") << QDateTime();
QTest::newRow("9") << QStringLiteral("Fri 24 Apr 2015 10:39:15 +02:af") << QDateTime();
QTest::newRow("10") << QStringLiteral("Fri 24 Apr 2015 10:39:15 +in:af") << QDateTime();
QTest::newRow("1") << QByteArray("Sat, 25 Apr 2015 12:10:48 +0000") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-25T12:10:48+00:00"), Qt::ISODate));
QTest::newRow("2") << QByteArray("Fri, 24 Apr 2015 10:22:42 +0200") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-24T10:22:42+02:00"), Qt::ISODate));
QTest::newRow("3") << QByteArray("Thu, 23 Apr 2015 21:43:32 -0300") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-23T21:43:32-03:00"), Qt::ISODate));
QTest::newRow("4") << QByteArray("Fri 24 Apr 2015 10:39:15 +0200") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-24T10:39:15+02:00"), Qt::ISODate));
QTest::newRow("5") << QByteArray("Fri 24 Apr 2015 10:39:15 +02:00") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-24T10:39:15+02:00"), Qt::ISODate));
QTest::newRow("6") << QByteArray("Fri 24 Apr 2015 10:39:15 +02:23") << QDateTime(QDateTime::fromString(QStringLiteral("2015-04-24T10:39:15+02:23"), Qt::ISODate));
QTest::newRow("7") << QByteArray("Fri 24 Apr 2015 10:39:15 +02a") << QDateTime();
QTest::newRow("8") << QByteArray("Fri 24 Apr 2015 10:39:15 +02:") << QDateTime();
QTest::newRow("9") << QByteArray("Fri 24 Apr 2015 10:39:15 +02:af") << QDateTime();
QTest::newRow("10") << QByteArray("Fri 24 Apr 2015 10:39:15 +in:af") << QDateTime();
}
void ParseDateTimeTest::testParseDateTime()
{
QFETCH(QString, input);
QFETCH(QByteArray, input);
QFETCH(QDateTime, expResult);
QDateTime result;
const char *scursor = input.toLatin1().constData();
const char *send = input.toLatin1().constData() + input.length();
const char *scursor = input.constData();
const char *send = input.constData() + input.length();
KMime::HeaderParsing::parseDateTime(scursor, send, result, false);
......
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