Commit 09c5ec7b authored by Laurent Montel's avatar Laurent Montel 😁

Start to create unittest for StringUtil::parseMailtoUrl

parent a1ca3102
......@@ -358,3 +358,24 @@ void StringUtilTest::test_stripOffMessagePrefix()
}
}
void StringUtilTest::test_parseMailtoUrl_data()
{
QTest::addColumn<QString>( "mailToUrl" );
QTest::addColumn<bool>( "toIsNotEmpty" );
QTest::addColumn<int>( "numberOfTo" );
QTest::newRow("1 mailto") << QString::fromLatin1("mailto:foo@kde.org") << true << 1;
//QTest::newRow("invalid") << QString::fromLatin1("fookde.org") << false << 0;
}
void StringUtilTest::test_parseMailtoUrl()
{
QFETCH( QString, mailToUrl );
QFETCH( bool, toIsNotEmpty );
QFETCH( int, numberOfTo );
KUrl url(mailToUrl);
QCOMPARE(!StringUtil::parseMailtoUrl(url).value(QLatin1String("to")).isEmpty(), toIsNotEmpty);
QCOMPARE(StringUtil::parseMailtoUrl(url).value(QLatin1String("to")).split(QLatin1String(", ")).count(), numberOfTo);
}
......@@ -32,6 +32,8 @@ class StringUtilTest : public QObject
void test_signatureStripping();
void test_isCryptoPart();
void test_stripOffMessagePrefix();
void test_parseMailtoUrl_data();
void test_parseMailtoUrl();
};
#endif
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