From 084d7147b84777c03688d2593e2d012f42f9df8a Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 4 Jul 2012 18:20:57 +2000 Subject: [PATCH] [PATCH 6/8] test: New test for incremental search output parsing --- 54/5c6a3735a7ec1a31686cb5dd6d70e19b7dcb96 | 128 ++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 54/5c6a3735a7ec1a31686cb5dd6d70e19b7dcb96 diff --git a/54/5c6a3735a7ec1a31686cb5dd6d70e19b7dcb96 b/54/5c6a3735a7ec1a31686cb5dd6d70e19b7dcb96 new file mode 100644 index 000000000..5b7a613fe --- /dev/null +++ b/54/5c6a3735a7ec1a31686cb5dd6d70e19b7dcb96 @@ -0,0 +1,128 @@ +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 68655431FC0 + for ; Tue, 3 Jul 2012 15:21:15 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 TZ+qZ51EA9FW for ; + Tue, 3 Jul 2012 15:21:11 -0700 (PDT) +Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU + [18.7.68.37]) + by olra.theworths.org (Postfix) with ESMTP id A418E431FC9 + for ; Tue, 3 Jul 2012 15:21:06 -0700 (PDT) +X-AuditID: 12074425-b7f9b6d0000008c4-5d-4ff370522f85 +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP + id E9.1B.02244.25073FF4; Tue, 3 Jul 2012 18:21:06 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q63ML4NJ002763; + Tue, 3 Jul 2012 18:21:05 -0400 +Received: from drake.dyndns.org (26-4-182.dynamic.csail.mit.edu [18.26.4.182]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q63ML1ol023224 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Tue, 3 Jul 2012 18:21:02 -0400 (EDT) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1SmBSv-0007fY-28; Tue, 03 Jul 2012 18:21:01 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH 6/8] test: New test for incremental search output parsing +Date: Tue, 3 Jul 2012 18:20:57 -0400 +Message-Id: <1341354059-29396-7-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1341354059-29396-1-git-send-email-amdragon@mit.edu> +References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFrrIIsWRmVeSWpSXmKPExsUixCmqrRtU8NnfYNJCbosje2axWyw985/Z + 4vrNmcwWb1bOY3Vg8dg56y67x+GvC1k8nq26xezR9GMxawBLFJdNSmpOZllqkb5dAlfG6rPN + 7AWX+Cua+s+xNDB+5eli5OSQEDCRuLlwMhuELSZx4d56IJuLQ0hgH6PE7iUtUM56Romj9/Yy + glQJCZxkkpjwmAMiMZdRonnaEXaQBJuAhsS2/cvBikQEpCV23p3NCmIzC+RKnG09DBYXFvCU + eDVvOtg6FgFViWkr1oDFeQUcJB5umsQOcYa8xNP7fWA1nAKOEitunmWBWOwgse1DB+sERv4F + jAyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdC30cjNL9FJTSjcxgkKO3UV1B+OEQ0qHGAU4GJV4 + eBMVPvsLsSaWFVfmHmKU5GBSEuW9kgcU4kvKT6nMSCzOiC8qzUktPsQowcGsJMK7Ogkox5uS + WFmVWpQPk5LmYFES572RctNfSCA9sSQ1OzW1ILUIJivDwaEkwduaD9QoWJSanlqRlplTgpBm + 4uAEGc4DNHwZSA1vcUFibnFmOkT+FKOilDhvFUhCACSRUZoH1wtLCa8YxYFeEebtBKniAaYT + uO5XQIOZgAbnLf4EMrgkESEl1cC4fPbLE54/WdmP+Ik1Nf/PmBRjbcu332mNvrSRsvjBRy9V + fe/OXrCHIfe9cc3K6i1dE99OO6abyijtofWgwaKCseLxdwbuzxPNLn3+Ntes6+W572vWevv3 + 7fjgnnlO/GnW3SnT0xoXZARqbTl6/FvFufadzZmzXz2S116V3rA886PQyyg2r38/lViKMxIN + tZiLihMB6z4zE+QCAAA= +Cc: tomi.ollila@iki.fi +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: Tue, 03 Jul 2012 22:21:15 -0000 + +This advises the search process filter to make it process one +character at a time in order to test the pessimal case for incremental +search output parsing. + +The text parser fails this test because it gets tricked into thinking +a parenthetical remark in a subject is the tag list. +--- + test/emacs | 11 +++++++++++ + test/test-lib.el | 8 ++++++++ + 2 files changed, 19 insertions(+) + +diff --git a/test/emacs b/test/emacs +index e9f954c..293b12a 100755 +--- a/test/emacs ++++ b/test/emacs +@@ -35,6 +35,17 @@ test_emacs '(notmuch-search "tag:inbox") + (test-output)' + test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox + ++test_begin_subtest "Incremental parsing of search results" ++test_subtest_known_broken ++test_emacs "(ad-enable-advice 'notmuch-search-process-filter 'around 'pessimal) ++ (ad-activate 'notmuch-search-process-filter) ++ (notmuch-search \"tag:inbox\") ++ (notmuch-test-wait) ++ (ad-disable-advice 'notmuch-search-process-filter 'around 'pessimal) ++ (ad-activate 'notmuch-search-process-filter) ++ (test-output)" ++test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox ++ + test_begin_subtest "Navigation of notmuch-hello to search results" + test_emacs '(notmuch-hello) + (goto-char (point-min)) +diff --git a/test/test-lib.el b/test/test-lib.el +index 6271da2..5dd6271 100644 +--- a/test/test-lib.el ++++ b/test/test-lib.el +@@ -89,6 +89,14 @@ nothing." + (add-hook-counter 'notmuch-hello-mode-hook) + (add-hook-counter 'notmuch-hello-refresh-hook) + ++(defadvice notmuch-search-process-filter (around pessimal activate disable) ++ "Feed notmuch-search-process-filter one character at a time." ++ (let ((string (ad-get-arg 1))) ++ (loop for char across string ++ do (progn ++ (ad-set-arg 1 (char-to-string char)) ++ ad-do-it)))) ++ + (defmacro notmuch-test-run (&rest body) + "Evaluate a BODY of test expressions and output the result." + `(with-temp-buffer +-- +1.7.10 + -- 2.26.2