[PATCH v2 1/3] test: Test buttonization of id: links
authorAustin Clements <amdragon@MIT.EDU>
Sun, 11 Nov 2012 04:46:13 +0000 (23:46 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:30 +0000 (09:50 -0800)
78/5da98be7d1020f68013976c53e0a275e05d582 [new file with mode: 0644]

diff --git a/78/5da98be7d1020f68013976c53e0a275e05d582 b/78/5da98be7d1020f68013976c53e0a275e05d582
new file mode 100644 (file)
index 0000000..3e1f0f3
--- /dev/null
@@ -0,0 +1,171 @@
+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 D3935431FBC\r
+       for <notmuch@notmuchmail.org>; Sat, 10 Nov 2012 20:46:27 -0800 (PST)\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 qWOiU+86pBxn for <notmuch@notmuchmail.org>;\r
+       Sat, 10 Nov 2012 20:46:26 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
+       [18.9.25.14])\r
+       by olra.theworths.org (Postfix) with ESMTP id C24B0431FAF\r
+       for <notmuch@notmuchmail.org>; Sat, 10 Nov 2012 20:46:26 -0800 (PST)\r
+X-AuditID: 1209190e-b7f756d000000904-87-509f2da241de\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 5D.98.02308.2AD2F905; Sat, 10 Nov 2012 23:46:26 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id qAB4kOkN008281; \r
+       Sat, 10 Nov 2012 23:46:24 -0500\r
+Received: from drake.dyndns.org\r
+       (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [209.6.116.242]) (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 qAB4kJbO001917\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sat, 10 Nov 2012 23:46:21 -0500 (EST)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1TXPR5-0003a3-LV; Sat, 10 Nov 2012 23:46:19 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 1/3] test: Test buttonization of id: links\r
+Date: Sat, 10 Nov 2012 23:46:13 -0500\r
+Message-Id: <1352609175-12790-2-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1352609175-12790-1-git-send-email-amdragon@mit.edu>\r
+References: <1352609175-12790-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsUixCmqrLtId36Awd4uFoum6c4W12/OZLZo\r
+       7XvK4sDscev+a3aPZ6tuMXts/PuDJYA5issmJTUnsyy1SN8ugSvjz6YetoIVohWH55o1ML4X\r
+       7GLk5JAQMJG4sXYBK4QtJnHh3nq2LkYuDiGBfYwSa6ceYYJwNjBKnNj3HyrziEniwNo+Rghn\r
+       LqNEy7EX7CD9bAIaEtv2L2cEsUUEpCV23p0NNpdZIFVi9c4OZhBbWMBW4nD7NyYQm0VAVeJq\r
+       w2WWLkYODl4BB4lPE/IhzlCU6H42gQ3E5hRwlOif8QdspBBQyZkf75knMPIvYGRYxSibklul\r
+       m5uYmVOcmqxbnJyYl5dapGusl5tZopeaUrqJERxaknw7GL8eVDrEKMDBqMTDe+PNvAAh1sSy\r
+       4srcQ4ySHExKorzJOvMDhPiS8lMqMxKLM+KLSnNSiw8xSnAwK4nw1u4AKudNSaysSi3Kh0lJ\r
+       c7AoifNeSbnpLySQnliSmp2aWpBaBJOV4eBQkuCdDjJUsCg1PbUiLTOnBCHNxMEJMpwHaPgj\r
+       LaAa3uKCxNzizHSI/ClGRSlxXg5toIQASCKjNA+uFxb7rxjFgV4R5j0JsoIHmDbgul8BDWYC\r
+       Gtx4ZA7I4JJEhJRUA6Ot827m+6vPfM6967PkivrvWbPkvn7VFTO7sKDecnuJWe0sN7Ommxrv\r
+       tk28lsf8LreGr+TfSY4alt4Zm4WSwoqmhUmce3f166n9fUwLljaVhKXM/hxyNvroI/+btpKn\r
+       gibW/DOPK6nZaWO75fa8WsazOroLTfcuvzTv7vk3f5ibHm/hlwr/wlOvxFKckWioxVxUnAgA\r
+       M3PDztgCAAA=\r
+Cc: sascha-ml-reply-to-2012-4@silbe.org\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: Sun, 11 Nov 2012 04:46:28 -0000\r
+\r
+This matches the current behavior of the buttonizer, so it passes, but\r
+many of these cases are not what you'd want (and some of them aren't\r
+even valid Xapian queries).  The next patch will fix the handling of\r
+these cases and update the test.\r
+---\r
+ test/emacs-show  |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++\r
+ test/test-lib.el |   14 ++++++++++++++\r
+ 2 files changed, 64 insertions(+)\r
+\r
+diff --git a/test/emacs-show b/test/emacs-show\r
+index 64c38d3..9712633 100755\r
+--- a/test/emacs-show\r
++++ b/test/emacs-show\r
+@@ -106,5 +106,55 @@ test_emacs '(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir st\r
+       (test-visible-output)'\r
+ test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-indent-thread-content-off\r
+ \r
++test_begin_subtest "id buttonization"\r
++add_message '[body]="\r
++id:abc\r
++id:abc.def. id:abc,def, id:abc;def; id:abc:def:\r
++id:foo@bar.?baz? id:foo@bar!.baz!\r
++(id:foo@bar.baz) [id:foo@bar.baz]\r
++id:foo@bar.baz...\r
++id:2+2=5\r
++id:=_-:/.[]@$%+\r
++id:abc)def\r
++id:ab\"c def\r
++id:\"abc\"def\r
++id:\"ab\"\"c\"def\r
++id:\"ab c\"def\r
++id:\"abc\".def\r
++id:\"abc\r
++\"\r
++id:)\r
++id:\r
++cid:xxx"'\r
++test_emacs '(notmuch-show "id:'$gen_msg_id'")\r
++      (notmuch-test-mark-links)\r
++      (test-visible-output)'\r
++cat <<EOF >EXPECTED\r
++Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)\r
++Subject: id buttonization\r
++To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++Date: Fri, 05 Jan 2001 15:43:57 +0000\r
++\r
++<<id:abc>>\r
++<<id:abc.def.>> <<id:abc,def,>> <<id:abc;def;>> <<id:abc:def:>>\r
++<<id:foo@bar.?baz?>> <<id:foo@bar!.baz!>>\r
++(<<id:foo@bar.baz)>> [<<id:foo@bar.baz]>>\r
++<<id:foo@bar.baz...>>\r
++<<id:2+2=5>>\r
++<<id:=_-:/.[]@$%+>>\r
++<<id:abc)def>>\r
++<<id:ab>>"c def\r
++<<id:"abc">>def\r
++<<id:"ab">>"c"def\r
++id:"ab c"def\r
++<<id:"abc">>.def\r
++id:"abc\r
++"\r
++<<id:)>>\r
++id:\r
++c<<id:xxx>>\r
++EOF\r
++test_expect_equal_file EXPECTED OUTPUT\r
++\r
+ \r
+ test_done\r
+diff --git a/test/test-lib.el b/test/test-lib.el\r
+index fa3380c..dece811 100644\r
+--- a/test/test-lib.el\r
++++ b/test/test-lib.el\r
+@@ -107,6 +107,20 @@ nothing."\r
+              (ad-set-arg 1 (char-to-string char))\r
+              ad-do-it))))\r
+ \r
++(defun notmuch-test-mark-links ()\r
++  "Enclose links in the current buffer with << and >>."\r
++  ;; Links are often created by jit-lock functions\r
++  (jit-lock-fontify-now)\r
++  (save-excursion\r
++    (let ((inhibit-read-only t))\r
++      (goto-char (point-min))\r
++      (let ((button))\r
++      (while (setq button (next-button (point)))\r
++        (goto-char (button-start button))\r
++        (insert "<<")\r
++        (goto-char (button-end button))\r
++        (insert ">>"))))))\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.4\r
+\r