diff options
author | Valerio Valerio <valerio.valerio@jollamobile.com> | 2014-08-20 15:38:42 +0300 |
---|---|---|
committer | Valerio Valerio <valerio.valerio@jollamobile.com> | 2014-08-21 15:12:41 +0200 |
commit | 7562fd2ed60c62dac98dd77458eb421cb0da4a38 (patch) | |
tree | 8b4b8835960c1cddb5bd467bbe05bbf367fea2c5 /tests | |
parent | 6a4026f64d04fe3225c03429b55345facf6a1644 (diff) |
Correctly parse display names having comments after the quoted string.
According to rfc2822 display names in the format: '"Example" (nested-comments)'
are valid and any existent nested comment should not be quoted.
Change-Id: Iaa3abef2307d2bf572ee7789574f2359549743b8
Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
Reviewed-by: Valerio Valerio <valerio.valerio@jollamobile.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tst_qmailaddress/tst_qmailaddress.cpp | 139 |
1 files changed, 130 insertions, 9 deletions
diff --git a/tests/tst_qmailaddress/tst_qmailaddress.cpp b/tests/tst_qmailaddress/tst_qmailaddress.cpp index dee10dcb..8d58590a 100644 --- a/tests/tst_qmailaddress/tst_qmailaddress.cpp +++ b/tests/tst_qmailaddress/tst_qmailaddress.cpp @@ -303,14 +303,71 @@ void tst_QMailAddress::constructor1_data() << "wizard@oz.test" << "\"O. Wizard\" <wizard@oz.test>"; - /* Honestly, I don't know what to do about this... - QTest::newRow("'\\' needs quoting") - << true - << "\"Wizard\\Oz\" <wizard@oz.test>" - << "Wizard\\Oz" - << "wizard@oz.test" - << "\"Wizard\\Oz\" <wizard@oz.test>"; + QTest::newRow("Quoted with trailing comment") + << true + << "\"Wizard+\" (wizard@oz.test) <wizard@oz.test>" + << "\"Wizard+\" (wizard@oz.test)" + << "wizard@oz.test" + << "\"Wizard+\" (wizard@oz.test) <wizard@oz.test>"; + + QTest::newRow("Quoted with 2 trailing comment") + << true + << "\"Wizard+\" (wizard@oz.test) (comment) <wizard@oz.test>" + << "\"Wizard+\" (wizard@oz.test) (comment)" + << "wizard@oz.test" + << "\"Wizard+\" (wizard@oz.test) (comment) <wizard@oz.test>"; + + QTest::newRow("2 comments with quote in the middle") + << true + << "(wizard@oz.test) \"Wizard+\" (comment) <wizard@oz.test>" + << "(wizard@oz.test) \"Wizard+\" (comment)" + << "wizard@oz.test" + << "(wizard@oz.test) \"Wizard+\" (comment) <wizard@oz.test>"; + + QTest::newRow("2 comments with name in the middle") + << true + << "(wizard@oz.test) WizardOz (comment) <wizard@oz.test>" + << "(wizard@oz.test) WizardOz (comment)" + << "wizard@oz.test" + << "(wizard@oz.test) WizardOz (comment) <wizard@oz.test>"; + + QTest::newRow("Word with quoted char in the middle") + << true + << "Wiz\"a\"rd+ <wizard@oz.test>" + << "Wiz\"a\"rd+" + << "wizard@oz.test" + << "Wiz\"a\"rd+ <wizard@oz.test>"; + + QTest::newRow("Quoted word with quoted char in the middle") + << true + << "\"Wiz\"a\"rd+\" <wizard@oz.test>" + << "Wiz\"a\"rd+" + << "wizard@oz.test" + << "\"Wiz\"a\"rd+\" <wizard@oz.test>"; + + QTest::newRow("Quoted word with comment with a quote") + << true + << "\"Wizard+\" (comment\"quoted\") <wizard@oz.test>" + << "\"Wizard+\" (comment\"quoted\")" + << "wizard@oz.test" + << "\"Wizard+\" (comment\"quoted\") <wizard@oz.test>"; + + QTest::newRow("Quoted word with empty space") + << true + << " \"Wizard+\" (comment) <wizard@oz.test>" + << "\"Wizard+\" (comment)" + << "wizard@oz.test" + << "\"Wizard+\" (comment) <wizard@oz.test>"; + + /*Honestly, I don't know what to do about this.. + QTest::newRow("'\\' needs quoting") + << true + << "\"Wizard\\Oz\" <wizard@oz.test>" + << "Wizard\\Oz" + << "wizard@oz.test" + << "\"Wizard\\Oz\" <wizard@oz.test>"; */ + } void tst_QMailAddress::constructor1() @@ -510,8 +567,72 @@ void tst_QMailAddress::constructor2_data() << "wizard@oz.test" << "\"O. Wizard\" <wizard@oz.test>"; - /* Honestly, I don't know what to do about this... - QTest::newRow("'\\' needs quoting") + QTest::newRow("Quoted with trailing comment") + << "\"Wizard+\" (wizard@oz.test)" + << "wizard@oz.test" + << true + << "\"Wizard+\" (wizard@oz.test)" + << "wizard@oz.test" + << "\"Wizard+\" (wizard@oz.test) <wizard@oz.test>"; + + QTest::newRow("Quoted with 2 trailing comment") + << "\"Wizard+\" (wizard@oz.test) (comment)" + << "wizard@oz.test" + << true + << "\"Wizard+\" (wizard@oz.test) (comment)" + << "wizard@oz.test" + << "\"Wizard+\" (wizard@oz.test) (comment) <wizard@oz.test>"; + + QTest::newRow("2 comments with quote in the middle") + << "(wizard@oz.test) \"Wizard+\" (comment)" + << "wizard@oz.test" + << true + << "(wizard@oz.test) \"Wizard+\" (comment)" + << "wizard@oz.test" + << "(wizard@oz.test) \"Wizard+\" (comment) <wizard@oz.test>"; + + QTest::newRow("2 comments with name in the middle") + << "(wizard@oz.test) WizardOz (comment)" + << "wizard@oz.test" + << true + << "(wizard@oz.test) WizardOz (comment)" + << "wizard@oz.test" + << "(wizard@oz.test) WizardOz (comment) <wizard@oz.test>"; + + QTest::newRow("Word with quoted char in the middle") + << "Wiz\"a\"rd+" + << "wizard@oz.test" + << true + << "Wiz\"a\"rd+" + << "wizard@oz.test" + << "Wiz\"a\"rd+ <wizard@oz.test>"; + + QTest::newRow("Quoted word with quoted char in the middle") + << "\"Wiz\"a\"rd+\"" + << "wizard@oz.test" + << true + << "Wiz\"a\"rd+" + << "wizard@oz.test" + << "\"Wiz\"a\"rd+\" <wizard@oz.test>"; + + QTest::newRow("Quoted word with comment with a quote") + << "\"Wizard+\" (comment\"quoted\")" + << "wizard@oz.test" + << true + << "\"Wizard+\" (comment\"quoted\")" + << "wizard@oz.test" + << "\"Wizard+\" (comment\"quoted\") <wizard@oz.test>"; + + QTest::newRow("Quoted word with empty space") + << " \"Wizard+\" (comment)" + << "wizard@oz.test" + << true + << "\"Wizard+\" (comment)" + << "wizard@oz.test" + << "\"Wizard+\" (comment) <wizard@oz.test>"; + + /* Honestly, I don't know what to do about this.. + QTest::newRow("'\\' needs quoting") << "Wizard\\Oz" << "wizard@oz.test" << true |