From: Austin Clements Date: Wed, 31 Oct 2012 02:29:20 +0000 (+2000) Subject: [PATCH 1/2] test: Test buttonization of id: links X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=1a272defa6bc626bb0946d8d47a85bbd2ec2aef5;p=notmuch-archives.git [PATCH 1/2] test: Test buttonization of id: links --- diff --git a/8b/3df03197c8fa7a2b508ef7064aa4bc41ae2a2c b/8b/3df03197c8fa7a2b508ef7064aa4bc41ae2a2c new file mode 100644 index 000000000..467025472 --- /dev/null +++ b/8b/3df03197c8fa7a2b508ef7064aa4bc41ae2a2c @@ -0,0 +1,159 @@ +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 CB8E6431FC0 + for ; Tue, 30 Oct 2012 19:29:35 -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 AopNwPL23Sd6 for ; + Tue, 30 Oct 2012 19:29:35 -0700 (PDT) +Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU + [18.9.25.15]) + by olra.theworths.org (Postfix) with ESMTP id 1E048431FAF + for ; Tue, 30 Oct 2012 19:29:35 -0700 (PDT) +X-AuditID: 1209190f-b7f636d00000095b-a8-50908d0e95ff +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP + id FF.90.02395.E0D80905; Tue, 30 Oct 2012 22:29:34 -0400 (EDT) +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 q9V2TWNo001666; + Tue, 30 Oct 2012 22:29:33 -0400 +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 q9V2TTIG027163 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Tue, 30 Oct 2012 22:29:31 -0400 (EDT) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1TTO3X-00021O-Ri; Tue, 30 Oct 2012 22:29:23 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH 1/2] test: Test buttonization of id: links +Date: Tue, 30 Oct 2012 22:29:20 -0400 +Message-Id: <1351650561-7331-2-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1351650561-7331-1-git-send-email-amdragon@mit.edu> +References: <1351650561-7331-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsUixCmqrcvXOyHAYPdaVYum6c4W12/OZHZg + 8rh1/zW7x7NVt5gDmKK4bFJSczLLUov07RK4Ms7te8Ze8Emo4t+tRsYGxsv8XYycHBICJhKf + TnxlgrDFJC7cW8/WxcjFISSwj1Fi6+LFrCAJIYENjBJ/9mZDJB4xSfSt62GHcOYySny4e5UZ + pIpNQENi2/7ljCC2iIC0xM67s4G6OTiYBcwlbrbEgYSFBawkzu9bwgZiswioSlxYegWsnFfA + XuLslj1sEFfISzy93wdmcwo4SDzdupYRZIwQUM3tlxITGPkXMDKsYpRNya3SzU3MzClOTdYt + Tk7My0st0jXRy80s0UtNKd3ECA4iSf4djN8OKh1iFOBgVOLh1fjeHyDEmlhWXJl7iFGSg0lJ + lLeoa0KAEF9SfkplRmJxRnxRaU5q8SFGCQ5mJRHeixlAOd6UxMqq1KJ8mJQ0B4uSOO/VlJv+ + QgLpiSWp2ampBalFMFkZDg4lCV7NHqBGwaLU9NSKtMycEoQ0EwcnyHAeoOER3SDDiwsSc4sz + 0yHypxgVpcR534AkBEASGaV5cL2wKH/FKA70ijCvC8gKHmCCgOt+BTSYCWiwDl8vyOCSRISU + VAOjiuAawVNCVR6Rb3QuW+fmtHj8/iOufEH+RP060be+kTO5yiNaVZmNrV4YsP5nXbv+s6T7 + JzuRV54xS8P2R5btFDPYt//eq12L/6b8dem3/bjQ5GZ82Zx1N4Rn7fr7f16mHVPKCTNuidaH + /4MKHK02Pubg0il5t+NFfOmMrGvTAoJFLaokv3gpsRRnJBpqMRcVJwIAS8hqks0CAAA= +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: Wed, 31 Oct 2012 02:29:36 -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 | 40 ++++++++++++++++++++++++++++++++++++++++ + test/test-lib.el | 14 ++++++++++++++ + 2 files changed, 54 insertions(+) + +diff --git a/test/emacs-show b/test/emacs-show +index 64c38d3..c4f3cf4 100755 +--- a/test/emacs-show ++++ b/test/emacs-show +@@ -106,5 +106,45 @@ 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: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 +