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 350A4431FBC for ; Thu, 13 Dec 2012 05:09:49 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, 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 CtW0PVEDeW6q for ; Thu, 13 Dec 2012 05:09:46 -0800 (PST) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id B1CBF431FBD for ; Thu, 13 Dec 2012 05:09:41 -0800 (PST) Received: by mail-wi0-f175.google.com with SMTP id hm11so3877843wib.2 for ; Thu, 13 Dec 2012 05:09:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=BRNqFBxfO9ijMPMa8c7dZTA8H8ngJpXVMDyzoW3gHK4=; b=uG6IxK9huzUDV7SZnRk12F6TYDljGSFzrn5uRlFsw8iA2eoliMfMIKNl8YSZKhQpSk wKpRLiEdBiHwNnyIXwFBSCLZk87kBEuOOEH8oXsPbO1ffQBXN5UWnsSaOtspWPEMS11c WE08VawHIh+g2TkiebtKVkGdIbdXnyMh4cuBUuAeS4/Zl/6/M/QIT42DBBwZiNjcinra HFInKEPudVqfz2OlCHPfHYrSUzXbq4uyTdK+MrtAqGCtczKfcgYahVW5SBcYQPQrWlV7 MgEiwSXkTWqim0lJ5N3RZShz9oN1FMYQhamFSK3RH+yl65uaV1Foe50hraEf2/yBkutC h5Pg== Received: by 10.180.76.203 with SMTP id m11mr3279182wiw.6.1355404181349; Thu, 13 Dec 2012 05:09:41 -0800 (PST) Received: from luz3.lille.inria.fr ([193.51.236.232]) by mx.google.com with ESMTPS id bz12sm2504214wib.5.2012.12.13.05.09.40 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Dec 2012 05:09:40 -0800 (PST) From: Damien Cassou To: notmuch@notmuchmail.org Subject: [PATCH 4/4] emacs: Add unit-tests for clickable tags Date: Thu, 13 Dec 2012 14:09:27 +0100 Message-Id: <1355404167-31750-5-git-send-email-damien.cassou@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1355404167-31750-1-git-send-email-damien.cassou@gmail.com> References: <1355404167-31750-1-git-send-email-damien.cassou@gmail.com> 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, 13 Dec 2012 13:09:49 -0000 Signed-off-by: Damien Cassou --- test/emacs | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/test/emacs b/test/emacs index 5403930..af9d37c 100755 --- a/test/emacs +++ b/test/emacs @@ -852,5 +852,108 @@ test_emacs "(let ((mm-text-html-renderer test_expect_success "Rendering HTML mail with images" \ 'cat OUTPUT && grep -q smiley OUTPUT' +test_begin_subtest "Extracting all tags from a thread" +add_message \ + '[subject]="Extracting all tags from a thread"' \ + '[body]="body 1"' +parent=${gen_msg_id} +add_message \ + '[subject]="Extracting all tags from a thread"' \ + '[body]="body 2"' \ + "[in-reply-to]=\<$parent\>" +add_message \ + '[subject]="Extracting all tags from a thread"' \ + '[body]="body 3"' \ + "[in-reply-to]=\<$parent\>" +latest=${gen_msg_id} +# Extract the thread-id from one of the emails +thread_id=$(notmuch search --output=threads id:${latest}) +echo THREAD ID: '"'$thread_id'"' +# Add tag "mytagfoo" to one of the emails +notmuch tag +mytagfoo id:${latest} +test_emacs_expect_t \ + "(notmuch-show \"${thread_id}\") + (let ((output (notmuch-show-thread-tags)) + (expected '(\"inbox\" \"mytagfoo\" \"unread\"))) + (notmuch-test-expect-equal + (sort output #'string<) + (sort expected #'string<)))" + +test_begin_subtest "The tags appear in the header-line of notmuch-show" +add_message \ + '[subject]="foo bar"' \ + '[body]="body 1"' +latest=${gen_msg_id} +# Add tag "mytagfoo" to one of the emails +notmuch tag +mytagfoo id:${latest} +# Extract the thread-id from one of the emails +thread_id=$(notmuch search --output=threads id:${latest}) +test_emacs_expect_t \ + "(notmuch-show \"${thread_id}\") + (if (string-match-p \"mytagfoo\" (format-mode-line header-line-format)) + t + \"The tag 'mytagfoo' was not in the header-line-format\")" + +test_begin_subtest "The tags appear in the header-line of notmuch-show even after update" +add_message \ + '[subject]="foo bar"' \ + '[body]="body 1"' +latest=${gen_msg_id} +# Extract the thread-id from one of the emails +thread_id=$(notmuch search --output=threads id:${latest}) +test_emacs_expect_t \ + "(notmuch-show \"${thread_id}\") + (if (string-match-p \"mytagfoo\" (format-mode-line header-line-format)) + (error \"There is no reason for 'mytagfoo' to be there.\")) + (notmuch-show-tag \"+mytagfoo\") + (if (string-match-p \"mytagfoo\" (format-mode-line header-line-format)) + t + \"The tag 'mytagfoo' was not in the header-line-format\")" + +test_begin_subtest "The tags of notmuch-show emails are clickable" +add_message \ + '[subject]="foo bar"' \ + '[body]="body 1"' +latest=${gen_msg_id} +# Add tag "mytagfoo" to one of the emails +notmuch tag +mytagfoo id:${latest} +# Extract the thread-id from one of the emails +thread_id=$(notmuch search --output=threads id:${latest}) +test_emacs_expect_t \ + "(notmuch-show \"${thread_id}\") + (goto-char (point-min)) + (re-search-forward \"mytagfoo\") + (backward-char) ;; to be 'in' the tag + (unless (eq major-mode 'notmuch-show-mode) + (error \"We must be in notmuch-show at this point but we are in %s.\" major-mode)) + (push-button) ;; simulate a press on the RET key + (if (eq major-mode 'notmuch-search-mode) + t + (format \"We must be in notmuch-search at this point but we are in %s.\" major-mode))" + +test_begin_subtest "The tags of notmuch-show emails are clickable even after update" +add_message \ + '[subject]="foo bar"' \ + '[body]="body 1"' +latest=${gen_msg_id} +# Extract the thread-id from one of the emails +thread_id=$(notmuch search --output=threads id:${latest}) +test_emacs_expect_t \ + "(notmuch-show \"${thread_id}\") + (goto-char (point-min)) + (if (re-search-forward \"mytagfoo\" nil t) + (error \"There is no reason for 'mytagfoo' to be there.\")) + (notmuch-show-tag \"+mytagfoo\") + (goto-char (point-min)) + (unless (re-search-forward \"mytagfoo\" nil t) + (error \"The tag 'mytagfoo' must have been there.\")) + (backward-char) ;; to be 'in' the tag + (unless (eq major-mode 'notmuch-show-mode) + (error \"We must be in notmuch-show at this point but we are in %s.\" major-mode)) + (push-button) ;; simulate a press on the RET key + (if (eq major-mode 'notmuch-search-mode) + t + (format \"We must be in notmuch-search at this point but we are in %s.\" major-mode))" + test_done -- 1.7.10.4