From 1d4f2e585ab224ae9dfd7f35a2fc55d376c62c20 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Fri, 24 Feb 2012 01:33:15 +0100 Subject: [PATCH] [PATCH] test: Add test for searching of uncommonly encoded messages --- 10/2d559a064efc0ba39195939d23eed990b272d2 | 109 ++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 10/2d559a064efc0ba39195939d23eed990b272d2 diff --git a/10/2d559a064efc0ba39195939d23eed990b272d2 b/10/2d559a064efc0ba39195939d23eed990b272d2 new file mode 100644 index 000000000..eeb947d13 --- /dev/null +++ b/10/2d559a064efc0ba39195939d23eed990b272d2 @@ -0,0 +1,109 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 11041431FAE + for ; Thu, 23 Feb 2012 16:33:40 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.3 +X-Spam-Level: +X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id hzCvSD7vRHJK for ; + Thu, 23 Feb 2012 16:33:38 -0800 (PST) +Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) + by olra.theworths.org (Postfix) with ESMTP id E6A09431FC3 + for ; Thu, 23 Feb 2012 16:33:37 -0800 (PST) +Received: from localhost (unknown [192.168.200.4]) + by max.feld.cvut.cz (Postfix) with ESMTP id 82F873CFEB7; + Fri, 24 Feb 2012 01:33:36 +0100 (CET) +X-Virus-Scanned: IMAP AMAVIS +Received: from max.feld.cvut.cz ([192.168.200.1]) + by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, + port 10044) + with ESMTP id mz5evMUfLTKr; Fri, 24 Feb 2012 01:33:35 +0100 (CET) +Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) + by max.feld.cvut.cz (Postfix) with ESMTP id A05B83CFEB0; + Fri, 24 Feb 2012 01:33:35 +0100 (CET) +Received: from steelpick.2x.cz (cable-86-56-3-85.cust.telecolumbus.net + [86.56.3.85]) (Authenticated sender: sojkam1) + by imap.feld.cvut.cz (Postfix) with ESMTPSA id 89809660968; + Fri, 24 Feb 2012 01:33:35 +0100 (CET) +Received: from wsh by steelpick.2x.cz with local (Exim 4.77) + (envelope-from ) + id 1S0j6M-0005kf-UD; Fri, 24 Feb 2012 01:33:34 +0100 +From: Michal Sojka +To: notmuch@notmuchmail.org +Subject: [PATCH] test: Add test for searching of uncommonly encoded messages +Date: Fri, 24 Feb 2012 01:33:15 +0100 +Message-Id: <1330043595-22054-1-git-send-email-sojkam1@fel.cvut.cz> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <877gzd5axk.fsf@steelpick.2x.cz> +References: <877gzd5axk.fsf@steelpick.2x.cz> +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 24 Feb 2012 00:33:40 -0000 + +Emails that are encoded differently than as ASCII or UTF-8 are not +indexed properly by notmuch. It is not possible to search for non-ASCII +words within those messages. +--- + test/encoding | 9 +++++++++ + test/test-lib.sh | 5 +++++ + 2 files changed, 14 insertions(+), 0 deletions(-) + +diff --git a/test/encoding b/test/encoding +index 33259c1..3992b5c 100755 +--- a/test/encoding ++++ b/test/encoding +@@ -21,4 +21,13 @@ irrelevant + +body} + +message}" + ++test_begin_subtest "Search for ISO-8859-2 encoded message" ++test_subtest_known_broken ++add_message '[content-type]="text/plain; charset=iso-8859-2"' \ ++ '[content-transfer-encoding]=8bit' \ ++ '[subject]="ISO-8859-2 encoded message"' \ ++ "[body]=$'Czech word tu\350\362\341\350\350\355 means pinguin\'s.'" # ISO-8859-2 characters are generated by shell's escape sequences ++output=$(notmuch search tučňáččí 2>&1 | notmuch_show_sanitize) ++test_expect_equal "$output" "thread:0000000000000002 2001-01-05 [1/1] Notmuch Test Suite; ISO-8859-2 encoded message (inbox unread)" ++ + test_done +diff --git a/test/test-lib.sh b/test/test-lib.sh +index 063a2b2..2781506 100644 +--- a/test/test-lib.sh ++++ b/test/test-lib.sh +@@ -356,6 +356,11 @@ ${additional_headers}" + ${additional_headers}" + fi + ++ if [ ! -z "${template[content-transfer-encoding]}" ]; then ++ additional_headers="Content-Transfer-Encoding: ${template[content-transfer-encoding]} ++${additional_headers}" ++ fi ++ + # Note that in the way we're setting it above and using it below, + # `additional_headers' will also serve as the header / body separator + # (empty line in between). +-- +1.7.9.1 + -- 2.26.2