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