From cd3a2b1b9a6e4459fe16522d8eb0824e31269608 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Fri, 6 Jul 2012 16:52:24 +2000 Subject: [PATCH] [PATCH v2 6/9] test: New test for incremental search output parsing --- 9c/82728285c9983a0f21b6e71805978ea6b16121 | 129 ++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 9c/82728285c9983a0f21b6e71805978ea6b16121 diff --git a/9c/82728285c9983a0f21b6e71805978ea6b16121 b/9c/82728285c9983a0f21b6e71805978ea6b16121 new file mode 100644 index 000000000..25943deb0 --- /dev/null +++ b/9c/82728285c9983a0f21b6e71805978ea6b16121 @@ -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 E0AA8431FBF + for ; Thu, 5 Jul 2012 13:52:50 -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 QDRa2rV-fFHc for ; + Thu, 5 Jul 2012 13:52:48 -0700 (PDT) +Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU + [18.9.25.12]) + by olra.theworths.org (Postfix) with ESMTP id CEB0B431FAE + for ; Thu, 5 Jul 2012 13:52:43 -0700 (PDT) +X-AuditID: 1209190c-b7f806d000006b87-9a-4ff5fe9ab89e +Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) + by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP + id A6.9F.27527.A9EF5FF4; Thu, 5 Jul 2012 16:52:42 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q65KqgLK019980; + Thu, 5 Jul 2012 16:52:42 -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 q65Kqb2Q027239 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Thu, 5 Jul 2012 16:52:39 -0400 (EDT) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1Smt2T-0004Xj-Kj; Thu, 05 Jul 2012 16:52:37 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v2 6/9] test: New test for incremental search output parsing +Date: Thu, 5 Jul 2012 16:52:24 -0400 +Message-Id: <1341521547-15502-7-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1341521547-15502-1-git-send-email-amdragon@mit.edu> +References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> + <1341521547-15502-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixG6nrjvr31d/gxk71CxWz+WxuH5zJrPF + m5XzWB2YPXbOusvucfjrQhaPZ6tuMQcwR3HZpKTmZJalFunbJXBlrD7bzF5wib+iqf8cSwPj + V54uRg4OCQETiSlTEroYOYFMMYkL99azdTFycQgJ7GOUmH5+JiuEs55R4smKFiYI5ySTxIX5 + C6CcuYwSd3/uYAXpZxPQkNi2fzkjiC0iIC2x8+5ssDizQJzElin/weLCAj4SLy+tAIuzCKhK + bH5wlRnE5hVwkGg78okR4g55iaf3+9hAbE4BR4kLExeDxYUEyiX+LPnHMoGRfwEjwypG2ZTc + Kt3cxMyc4tRk3eLkxLy81CJdQ73czBK91JTSTYyg4OKU5NnB+Oag0iFGAQ5GJR5eo9wv/kKs + iWXFlbmHGCU5mJREeRt/f/UX4kvKT6nMSCzOiC8qzUktPsQowcGsJMLbmwGU401JrKxKLcqH + SUlzsCiJ815OuekvJJCeWJKanZpakFoEk5Xh4FCS4F35F6hRsCg1PbUiLTOnBCHNxMEJMpwH + aPhakBre4oLE3OLMdIj8KUZFKXHemSAJAZBERmkeXC8s+l8xigO9Isy7HaSKB5g44LpfAQ1m + Ahqct/gTyOCSRISUVAOjzPGpyj8e6y9RKJA8u33Tvqh/R9o93jAtc+r2EG05YWRy+H54xh7X + zzxPDs/miti8zIL1W6Mh937Nxfc3NpatFjs8K7l5aujlrWdDVjjcmhmUPS/Y4sW5pOSYJ/vS + HjKGc5h1TtPeys0XHTvH9cCk3UtmvXe58MRhv7sU38y5auLyHi9Xrf1bocRSnJFoqMVcVJwI + AAEptZzZAgAA +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: Thu, 05 Jul 2012 20:52: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 + -- 2.26.2