[PATCH v3 1/3] test: Test buttonization of id: links
authorAustin Clements <amdragon@MIT.EDU>
Thu, 15 Nov 2012 19:49:52 +0000 (14:49 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:36 +0000 (09:50 -0800)
a5/bad9e4e5d3c9392d93ac88a1b26f5f1185433e [new file with mode: 0644]

diff --git a/a5/bad9e4e5d3c9392d93ac88a1b26f5f1185433e b/a5/bad9e4e5d3c9392d93ac88a1b26f5f1185433e
new file mode 100644 (file)
index 0000000..f3ed8ba
--- /dev/null
@@ -0,0 +1,169 @@
+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 64624431FDE\r
+       for <notmuch@notmuchmail.org>; Thu, 15 Nov 2012 11:50:19 -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 c6NZgjrbi5Ro for <notmuch@notmuchmail.org>;\r
+       Thu, 15 Nov 2012 11:50:17 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
+       [18.7.68.35])\r
+       by olra.theworths.org (Postfix) with ESMTP id 03182431FC4\r
+       for <notmuch@notmuchmail.org>; Thu, 15 Nov 2012 11:50:12 -0800 (PST)\r
+X-AuditID: 12074423-b7fab6d0000008f9-76-50a54774e2fa\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 3B.ED.02297.47745A05; Thu, 15 Nov 2012 14:50:12 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id qAFJo1Up005191; \r
+       Thu, 15 Nov 2012 14:50:01 -0500\r
+Received: from drake.dyndns.org (26-4-172.dynamic.csail.mit.edu [18.26.4.172])\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 qAFJnuZ3018786\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Thu, 15 Nov 2012 14:49:59 -0500 (EST)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1TZ5Rk-0004YA-Mn; Thu, 15 Nov 2012 14:49:56 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 1/3] test: Test buttonization of id: links\r
+Date: Thu, 15 Nov 2012 14:49:52 -0500\r
+Message-Id: <1353008994-17305-2-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1353008994-17305-1-git-send-email-amdragon@mit.edu>\r
+References: <1353008994-17305-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsUixCmqrVvivjTA4OQlJYvrN2cyW7xZOY/V\r
+       gcnj8NeFLB7PVt1iDmCK4rJJSc3JLEst0rdL4MpY2LqAtWCFaMXBOXNZGhjfC3YxcnBICJhI\r
+       tE2u62LkBDLFJC7cW8/WxcjFISSwj1Fi3euH7BDOBkaJc787WCCcU0wS1//sg3LmMkpcmbya\r
+       FaSfTUBDYtv+5YwgtoiAtMTOu7PB4swCVhKHr25iBVknLGArse9oEojJIqAqceaBE0gFr4CD\r
+       xJOjDYwQVyhKdD+bwAZicwo4Shy5NBPMFgKquffxLtsERv4FjAyrGGVTcqt0cxMzc4pTk3WL\r
+       kxPz8lKLdM30cjNL9FJTSjcxgsKI3UV5B+Ofg0qHGAU4GJV4eE/cXBwgxJpYVlyZe4hRkoNJ\r
+       SZQ30WZpgBBfUn5KZUZicUZ8UWlOavEhRgkOZiURXk85oBxvSmJlVWpRPkxKmoNFSZz3WspN\r
+       fyGB9MSS1OzU1ILUIpisDAeHkgRvrRtQo2BRanpqRVpmTglCmomDE2Q4D9BwB5Aa3uKCxNzi\r
+       zHSI/ClGRSlxXk+QhABIIqM0D64XFuevGMWBXhHmjQWp4gGmCLjuV0CDmYAGb5FZAjK4JBEh\r
+       JdXAyKlk4hPILLLkWLD3vSkxfyv5dvl8LTy6VW51aEP7TLUHB7fs3218sXx/fniyxPvi0FM8\r
+       116/Pf/t+3vrv3elhauFnFMl3T9WCP5Qt99SZ+3lseGW2ZlX3oYXv1W4ZU28/OnZp4d7j6yf\r
+       pl1/kDeybcm74nWPTRg43icv+bFgTdDV0IaEl0qhE5VYijMSDbWYi4oTAaSKJcrOAgAA\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, 15 Nov 2012 19:50:19 -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..5d7151b 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 OUTPUT EXPECTED\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