summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/mime/test/unit/test_EncodeMimePartIIStr_UTF8.js
diff options
context:
space:
mode:
Diffstat (limited to 'comm/mailnews/mime/test/unit/test_EncodeMimePartIIStr_UTF8.js')
-rw-r--r--comm/mailnews/mime/test/unit/test_EncodeMimePartIIStr_UTF8.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/comm/mailnews/mime/test/unit/test_EncodeMimePartIIStr_UTF8.js b/comm/mailnews/mime/test/unit/test_EncodeMimePartIIStr_UTF8.js
new file mode 100644
index 0000000000..71d31da9ac
--- /dev/null
+++ b/comm/mailnews/mime/test/unit/test_EncodeMimePartIIStr_UTF8.js
@@ -0,0 +1,39 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// This tests minimal mime encoding fixed in bug 458685
+
+var { MailServices } = ChromeUtils.import(
+ "resource:///modules/MailServices.jsm"
+);
+
+function run_test() {
+ var i;
+
+ var checks = [
+ ["", false, ""],
+ ["\u0436", false, "=?UTF-8?B?0LY=?="], // CYRILLIC SMALL LETTER ZHE
+ ["IamASCII", false, "IamASCII"],
+ // Although an invalid email, we shouldn't crash on it (bug 479206)
+ ["crash test@foo.invalid>", true, '"crash test"@foo.invalid'],
+ [
+ "MXR now displays links to Github log & Blame for\r\n Gaia/Rust/Servo",
+ false,
+ "MXR now displays links to Github log & Blame for\r\n Gaia/Rust/Servo",
+ ],
+ ["-----------------------:", false, "-----------------------:"],
+ ];
+
+ for (i = 0; i < checks.length; ++i) {
+ Assert.equal(
+ MailServices.mimeConverter.encodeMimePartIIStr_UTF8(
+ checks[i][0],
+ checks[i][1],
+ "Subject".length,
+ 72
+ ),
+ checks[i][2]
+ );
+ }
+}