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