|
@@ -21,8 +21,8 @@ using svapi::functions::MimeWords;
|
|
|
TEST(MimeWords, DecodesANameInFrontOfAnAddressLeavingTheAddressAlone) {
|
|
TEST(MimeWords, DecodesANameInFrontOfAnAddressLeavingTheAddressAlone) {
|
|
|
// The shape that started it: only the display name is encoded, and the
|
|
// The shape that started it: only the display name is encoded, and the
|
|
|
// address must come through untouched.
|
|
// address must come through untouched.
|
|
|
- EXPECT_EQ(MimeWords::decode("=?UTF-8?Q?Szont=C3=A1gh_Ferenc?= <ferenc.szontagh@smartbotics.ai>"),
|
|
|
|
|
- "Szontágh Ferenc <ferenc.szontagh@smartbotics.ai>");
|
|
|
|
|
|
|
+ EXPECT_EQ(MimeWords::decode("=?UTF-8?Q?K=C5=91v=C3=A1g=C3=B3_=C3=96rs?= <ors.kovago@example.com>"),
|
|
|
|
|
+ "Kővágó Örs <ors.kovago@example.com>");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
TEST(MimeWords, RejoinsTwoWordsWithoutTheFoldSpace) {
|
|
TEST(MimeWords, RejoinsTwoWordsWithoutTheFoldSpace) {
|
|
@@ -80,14 +80,14 @@ TEST(MimeWords, ExistingQuotesAreNotDoubled) {
|
|
|
TEST(MimeWords, RoundTripsWhateverWeSend) {
|
|
TEST(MimeWords, RoundTripsWhateverWeSend) {
|
|
|
// The property that matters most: whatever we send, a conforming reader
|
|
// The property that matters most: whatever we send, a conforming reader
|
|
|
// gets back what we meant.
|
|
// gets back what we meant.
|
|
|
- for (const std::string& original : {std::string("Szontágh Ferenc"),
|
|
|
|
|
|
|
+ for (const std::string& original : {std::string("Kővágó Örs"),
|
|
|
std::string("Sárkányok párzási és étkezési szokásaik"),
|
|
std::string("Sárkányok párzási és étkezési szokásaik"),
|
|
|
std::string("árvíztűrő tükörfúrógép"),
|
|
std::string("árvíztűrő tükörfúrógép"),
|
|
|
std::string("plain ascii")})
|
|
std::string("plain ascii")})
|
|
|
EXPECT_EQ(MimeWords::decode(MimeWords::encode(original)), original) << original;
|
|
EXPECT_EQ(MimeWords::decode(MimeWords::encode(original)), original) << original;
|
|
|
|
|
|
|
|
- EXPECT_EQ(MimeWords::decode(MimeWords::encodeAddress("Szontágh Ferenc <a@b.com>")),
|
|
|
|
|
- "Szontágh Ferenc <a@b.com>");
|
|
|
|
|
|
|
+ EXPECT_EQ(MimeWords::decode(MimeWords::encodeAddress("Kővágó Örs <a@b.com>")),
|
|
|
|
|
+ "Kővágó Örs <a@b.com>");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// --- the header/envelope distinction, which is where a send breaks ----------
|
|
// --- the header/envelope distinction, which is where a send breaks ----------
|
|
@@ -97,7 +97,7 @@ TEST(MimeWords, TheEnvelopeTakesAnAddressAndNothingElse) {
|
|
|
// by dropping the connection - reported as "Failed sending data to the
|
|
// by dropping the connection - reported as "Failed sending data to the
|
|
|
// peer", which names neither the address nor the reason. That is why this
|
|
// peer", which names neither the address nor the reason. That is why this
|
|
|
// function exists rather than being a caller's responsibility.
|
|
// function exists rather than being a caller's responsibility.
|
|
|
- EXPECT_EQ(MimeWords::envelopeAddress("Szontágh Ferenc <a@b.com>"), "a@b.com");
|
|
|
|
|
|
|
+ EXPECT_EQ(MimeWords::envelopeAddress("Kővágó Örs <a@b.com>"), "a@b.com");
|
|
|
EXPECT_EQ(MimeWords::envelopeAddress("a@b.com"), "a@b.com");
|
|
EXPECT_EQ(MimeWords::envelopeAddress("a@b.com"), "a@b.com");
|
|
|
EXPECT_EQ(MimeWords::envelopeAddress(" a@b.com "), "a@b.com");
|
|
EXPECT_EQ(MimeWords::envelopeAddress(" a@b.com "), "a@b.com");
|
|
|
EXPECT_EQ(MimeWords::envelopeAddress("\"Doe, John\" <a@b.com>"), "a@b.com");
|
|
EXPECT_EQ(MimeWords::envelopeAddress("\"Doe, John\" <a@b.com>"), "a@b.com");
|
|
@@ -108,12 +108,12 @@ TEST(MimeWords, OneAddressYieldsTwoDifferentThings) {
|
|
|
// (RFC 5322 name-addr, which is what the recipient's client shows) and the
|
|
// (RFC 5322 name-addr, which is what the recipient's client shows) and the
|
|
|
// ENVELOPE drops it (RFC 5321 takes an address only). They are two
|
|
// ENVELOPE drops it (RFC 5321 takes an address only). They are two
|
|
|
// different "To"s, and feeding one to the other is what broke a send.
|
|
// different "To"s, and feeding one to the other is what broke a send.
|
|
|
- const std::string address = "Szontágh Ferenc <ferenc.szontagh@smartbotics.ai>";
|
|
|
|
|
|
|
+ const std::string address = "Kővágó Örs <ors.kovago@example.com>";
|
|
|
const std::string header = MimeWords::encodeAddress(address);
|
|
const std::string header = MimeWords::encodeAddress(address);
|
|
|
EXPECT_EQ(MimeWords::decode(header), address) << "the header round-trips to what was meant";
|
|
EXPECT_EQ(MimeWords::decode(header), address) << "the header round-trips to what was meant";
|
|
|
- EXPECT_NE(header.find("ferenc.szontagh@smartbotics.ai"), std::string::npos)
|
|
|
|
|
|
|
+ EXPECT_NE(header.find("ors.kovago@example.com"), std::string::npos)
|
|
|
<< "and keeps the address untouched: " << header;
|
|
<< "and keeps the address untouched: " << header;
|
|
|
- EXPECT_EQ(MimeWords::envelopeAddress(address), "ferenc.szontagh@smartbotics.ai");
|
|
|
|
|
|
|
+ EXPECT_EQ(MimeWords::envelopeAddress(address), "ors.kovago@example.com");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
TEST(MimeWords, AFilenameUsesRfc2231WhenItNeedsTo) {
|
|
TEST(MimeWords, AFilenameUsesRfc2231WhenItNeedsTo) {
|