[PATCH v2 6/9] test: New test for incremental search output parsing
authorAustin Clements <amdragon@MIT.EDU>
Thu, 5 Jul 2012 20:52:24 +0000 (16:52 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:01 +0000 (09:48 -0800)
9c/82728285c9983a0f21b6e71805978ea6b16121 [new file with mode: 0644]

diff --git a/9c/82728285c9983a0f21b6e71805978ea6b16121 b/9c/82728285c9983a0f21b6e71805978ea6b16121
new file mode 100644 (file)
index 0000000..25943de
--- /dev/null
@@ -0,0 +1,129 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id E0AA8431FBF\r
+       for <notmuch@notmuchmail.org>; Thu,  5 Jul 2012 13:52:50 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id QDRa2rV-fFHc for <notmuch@notmuchmail.org>;\r
+       Thu,  5 Jul 2012 13:52:48 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
+       [18.9.25.12])\r
+       by olra.theworths.org (Postfix) with ESMTP id CEB0B431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  5 Jul 2012 13:52:43 -0700 (PDT)\r
+X-AuditID: 1209190c-b7f806d000006b87-9a-4ff5fe9ab89e\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id A6.9F.27527.A9EF5FF4; Thu,  5 Jul 2012 16:52:42 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q65KqgLK019980; \r
+       Thu, 5 Jul 2012 16:52:42 -0400\r
+Received: from drake.dyndns.org (26-4-182.dynamic.csail.mit.edu [18.26.4.182])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q65Kqb2Q027239\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Thu, 5 Jul 2012 16:52:39 -0400 (EDT)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1Smt2T-0004Xj-Kj; Thu, 05 Jul 2012 16:52:37 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 6/9] test: New test for incremental search output parsing\r
+Date: Thu,  5 Jul 2012 16:52:24 -0400\r
+Message-Id: <1341521547-15502-7-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1341521547-15502-1-git-send-email-amdragon@mit.edu>\r
+References: <1341354059-29396-1-git-send-email-amdragon@mit.edu>\r
+       <1341521547-15502-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixG6nrjvr31d/gxk71CxWz+WxuH5zJrPF\r
+       m5XzWB2YPXbOusvucfjrQhaPZ6tuMQcwR3HZpKTmZJalFunbJXBlrD7bzF5wib+iqf8cSwPj\r
+       V54uRg4OCQETiSlTEroYOYFMMYkL99azdTFycQgJ7GOUmH5+JiuEs55R4smKFiYI5ySTxIX5\r
+       C6CcuYwSd3/uYAXpZxPQkNi2fzkjiC0iIC2x8+5ssDizQJzElin/weLCAj4SLy+tAIuzCKhK\r
+       bH5wlRnE5hVwkGg78okR4g55iaf3+9hAbE4BR4kLExeDxYUEyiX+LPnHMoGRfwEjwypG2ZTc\r
+       Kt3cxMyc4tRk3eLkxLy81CJdQ73czBK91JTSTYyg4OKU5NnB+Oag0iFGAQ5GJR5eo9wv/kKs\r
+       iWXFlbmHGCU5mJREeRt/f/UX4kvKT6nMSCzOiC8qzUktPsQowcGsJMLbmwGU401JrKxKLcqH\r
+       SUlzsCiJ815OuekvJJCeWJKanZpakFoEk5Xh4FCS4F35F6hRsCg1PbUiLTOnBCHNxMEJMpwH\r
+       aPhakBre4oLE3OLMdIj8KUZFKXHemSAJAZBERmkeXC8s+l8xigO9Isy7HaSKB5g44LpfAQ1m\r
+       Ahqct/gTyOCSRISUVAOjzPGpyj8e6y9RKJA8u33Tvqh/R9o93jAtc+r2EG05YWRy+H54xh7X\r
+       zzxPDs/miti8zIL1W6Mh937Nxfc3NpatFjs8K7l5aujlrWdDVjjcmhmUPS/Y4sW5pOSYJ/vS\r
+       HjKGc5h1TtPeys0XHTvH9cCk3UtmvXe58MRhv7sU38y5auLyHi9Xrf1bocRSnJFoqMVcVJwI\r
+       AAEptZzZAgAA\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 05 Jul 2012 20:52:51 -0000\r
+\r
+This advises the search process filter to make it process one\r
+character at a time in order to test the pessimal case for incremental\r
+search output parsing.\r
+\r
+The text parser fails this test because it gets tricked into thinking\r
+a parenthetical remark in a subject is the tag list.\r
+---\r
+ test/emacs       |   11 +++++++++++\r
+ test/test-lib.el |    8 ++++++++\r
+ 2 files changed, 19 insertions(+)\r
+\r
+diff --git a/test/emacs b/test/emacs\r
+index e9f954c..293b12a 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -35,6 +35,17 @@ test_emacs '(notmuch-search "tag:inbox")\r
+           (test-output)'\r
+ test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox\r
+ \r
++test_begin_subtest "Incremental parsing of search results"\r
++test_subtest_known_broken\r
++test_emacs "(ad-enable-advice 'notmuch-search-process-filter 'around 'pessimal)\r
++          (ad-activate 'notmuch-search-process-filter)\r
++          (notmuch-search \"tag:inbox\")\r
++          (notmuch-test-wait)\r
++          (ad-disable-advice 'notmuch-search-process-filter 'around 'pessimal)\r
++          (ad-activate 'notmuch-search-process-filter)\r
++          (test-output)"\r
++test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox\r
++\r
+ test_begin_subtest "Navigation of notmuch-hello to search results"\r
+ test_emacs '(notmuch-hello)\r
+           (goto-char (point-min))\r
+diff --git a/test/test-lib.el b/test/test-lib.el\r
+index 6271da2..5dd6271 100644\r
+--- a/test/test-lib.el\r
++++ b/test/test-lib.el\r
+@@ -89,6 +89,14 @@ nothing."\r
+ (add-hook-counter 'notmuch-hello-mode-hook)\r
+ (add-hook-counter 'notmuch-hello-refresh-hook)\r
+ \r
++(defadvice notmuch-search-process-filter (around pessimal activate disable)\r
++  "Feed notmuch-search-process-filter one character at a time."\r
++  (let ((string (ad-get-arg 1)))\r
++    (loop for char across string\r
++        do (progn\r
++             (ad-set-arg 1 (char-to-string char))\r
++             ad-do-it))))\r
++\r
+ (defmacro notmuch-test-run (&rest body)\r
+   "Evaluate a BODY of test expressions and output the result."\r
+   `(with-temp-buffer\r
+-- \r
+1.7.10\r
+\r