From: Austin Clements Date: Mon, 9 Jul 2012 21:42:39 +0000 (+2000) Subject: [PATCH v3 6/9] test: New test for incremental search output parsing X-Git-Url: http://git.tremily.us/?p=notmuch-archives.git;a=commitdiff_plain;h=105adb4a95e9300d551845e560bfbdb7ea593696 [PATCH v3 6/9] test: New test for incremental search output parsing --- diff --git a/3b/318d7c2ecee60b326e271729bc9e6b9624ed44 b/3b/318d7c2ecee60b326e271729bc9e6b9624ed44 new file mode 100644 index 000000000..8178143bb --- /dev/null +++ b/3b/318d7c2ecee60b326e271729bc9e6b9624ed44 @@ -0,0 +1,129 @@ +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 41CA6429E36 + for ; Mon, 9 Jul 2012 14:42:51 -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 U0i4V3j69AU3 for ; + Mon, 9 Jul 2012 14:42:50 -0700 (PDT) +Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU + [18.9.25.13]) + by olra.theworths.org (Postfix) with ESMTP id 905CE431E64 + for ; Mon, 9 Jul 2012 14:42:49 -0700 (PDT) +X-AuditID: 1209190d-b7fd56d000000933-90-4ffb50585e32 +Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) + by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP + id A8.19.02355.8505BFF4; Mon, 9 Jul 2012 17:42:48 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q69Lgl1p003850; + Mon, 9 Jul 2012 17:42:47 -0400 +Received: from drake.dyndns.org (26-4-176.dynamic.csail.mit.edu [18.26.4.176]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q69LgiQM022688 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Mon, 9 Jul 2012 17:42:47 -0400 (EDT) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1SoLjA-0004g3-1i; Mon, 09 Jul 2012 17:42:44 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v3 6/9] test: New test for incremental search output parsing +Date: Mon, 9 Jul 2012 17:42:39 -0400 +Message-Id: <1341870162-17782-7-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1341870162-17782-1-git-send-email-amdragon@mit.edu> +References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> + <1341870162-17782-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixG6nohsR8Nvf4MNzQ4vVc3ksrt+cyWzx + ZuU8Vgdmj52z7rJ7HP66kMXj2apbzAHMUVw2Kak5mWWpRfp2CVwZq882sxdc4q9o6j/H0sD4 + laeLkZNDQsBEYuKOPewQtpjEhXvr2boYuTiEBPYxSjw78YUZwlnPKHH24RVGCOckk8SntmlQ + mbmMEt82vmEC6WcT0JDYtn85I4gtIiAtsfPubFYQm1kgTmLLlP9gcWEBH4l77/aC7WMRUJX4 + +7UBrJdXwEHi4osPrBB3yEs8vd/HBmJzCjhKzLm5A6xXSKBc4vONf8wTGPkXMDKsYpRNya3S + zU3MzClOTdYtTk7My0st0jXSy80s0UtNKd3ECAovTkneHYzvDiodYhTgYFTi4Y1i+u0vxJpY + VlyZe4hRkoNJSZQ3zxMoxJeUn1KZkVicEV9UmpNafIhRgoNZSYT3litQjjclsbIqtSgfJiXN + waIkznsl5aa/kEB6YklqdmpqQWoRTFaGg0NJgneaP1CjYFFqempFWmZOCUKaiYMTZDgP0PAJ + IDW8xQWJucWZ6RD5U4yKUuK8k0ESAiCJjNI8uF5Y/L9iFAd6RZh3B0gVDzB1wHW/AhrMBDS4 + vecXyOCSRISUVAOjrcGOnPuJbyO3sFjzLzwv0fjt0FWRTx1LT67/OvPpi9Mzb7QY+txNfc9t + ckLg7p3/lica66TvHz+ubqk9xSbN77hN81Gv0pRp2zbNnLx65vfKpBc3HWdNzRftNi4T/NRW + 2ha8T/jcRMmJhapVMybfW3D+3oVJLk5LdHuU/4vf2n81Nb3L+V5WshJLcUaioRZzUXEiAEgY + q0XaAgAA +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: Mon, 09 Jul 2012 21:42:51 -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 +