Commit ac994eb3 authored by Laurent Montel's avatar Laurent Montel 😁

Add more autotests

parent f6960615
......@@ -89,6 +89,18 @@ void CheckDuplicateEmailsJobTest::shouldReturnEmails_data()
result.insert(QStringLiteral("blo@kde.org"), 2);
QTest::newRow("twoduplicateemailswithdifferentvalue") << lst << result;
lst.clear();
lst.append(QStringLiteral("foo <foo@kde.org>"));
lst.append(QStringLiteral("foo@kde.org"));
lst.append(QStringLiteral("foo@kde.org"));
lst.append(QStringLiteral("blo@kde.org"));
lst.append(QStringLiteral("blo@kde.org"));
result.clear();
result.insert(QStringLiteral("foo@kde.org"), 3);
result.insert(QStringLiteral("blo@kde.org"), 2);
QTest::newRow("twoduplicateemailswithemailname") << lst << result;
}
void CheckDuplicateEmailsJobTest::shouldReturnEmails()
......
......@@ -41,11 +41,13 @@ void CheckDuplicateEmailsJob::start()
QString tname, temail;
KEmailAddress::extractEmailAddressAndName(email, temail, tname); // ignore return value
int val = results.value(temail, 0);
if (val == 0) {
results.insert(temail, val+1);
} else {
results[temail] = val+1;
if (!temail.isEmpty()) {
const int val = results.value(temail, 0);
if (val == 0) {
results.insert(temail, val+1);
} else {
results[temail] = val+1;
}
}
}
QMapIterator<QString, int> i(results);
......
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