From 37d2c3609bacdef12e6c1a832314fca7441d1a95 Mon Sep 17 00:00:00 2001 From: cketti Date: Sat, 14 Oct 2017 06:01:05 +0200 Subject: [PATCH] Modify tests for text wrongly split into encoded words We were using test data submitted by users. But we don't really know what the expected result should be. In the second test the expected text ended in a replacement character. That indicates the text is not decoded correctly. Maybe there was an additional encoded word that was missing. --- .../fsck/k9/mail/internet/DecoderUtilTest.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/k9mail-library/src/test/java/com/fsck/k9/mail/internet/DecoderUtilTest.java b/k9mail-library/src/test/java/com/fsck/k9/mail/internet/DecoderUtilTest.java index 8c749f71c..8025c64d6 100644 --- a/k9mail-library/src/test/java/com/fsck/k9/mail/internet/DecoderUtilTest.java +++ b/k9mail-library/src/test/java/com/fsck/k9/mail/internet/DecoderUtilTest.java @@ -114,17 +114,10 @@ public class DecoderUtilTest { @Test public void decodeEncodedWords_withMultipleEncodedSections_decodesSequentialSectionTogether() { - //Splitting mid-character is RFC2047 non-compliant but seen in practice. - String input = "=?utf-8?B?5Liq5Lq66YKu566xOkJVRyAjMzAyNDY6OumCruS7tuato+aWh+mZhOS7tuWQ?=\n" + - "=?utf-8?B?jeensOecgeeVpeaYvuekuuS8mOWMlg==?="; - assertInputDecodesToExpected(input, "个人邮箱:BUG #30246::邮件正文附件名称省略显示优化"); - } - - @Test - public void decodeEncodedWords_withGB2312_decodes_correctly() { - String input = "=?gb2312?B?Obv9t9az6cnu29rHsLqju6rHyLPHSlfN8rrAvsa16qOsuPzT0DIwvNIzOTnU?= " + - "=?gb2312?B?qr6r0aG439DHytTLr77Gteq1yMTjwLSjoaOoQUSjqQ?="; - assertInputDecodesToExpected(input, "9积分抽深圳前海华侨城JW万豪酒店,更有20家399元精选高星试睡酒店等你来!(AD�"); + // Splitting mid-character is RFC2047 non-compliant but seen in practice. + // "=?utf-8?B?b2hhaSDw?=" individually decodes to "ohai �" + // "=?utf-8?B?n5Kp==?=" individually decodes to "���" + assertInputDecodesToExpected("=?utf-8?B?b2hhaSDw?= =?utf-8?B?n5Kp?=", "ohai 💩"); } @Test