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 49276431FD9 for ; Tue, 11 Dec 2012 01:00:54 -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 Se9T5WwCEPYd for ; Tue, 11 Dec 2012 01:00:52 -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 2855C431FBC for ; Tue, 11 Dec 2012 01:00:49 -0800 (PST) Received: by mail-wi0-f175.google.com with SMTP id hm11so1683809wib.2 for ; Tue, 11 Dec 2012 01:00:48 -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=G+VGizi1tQ4364bUXhifTFRcQFd5SU79EcR5yZzznpI=; b=JHfKaMWFmvM0DXcO7ZTfb5x53VwazB21T7BtjIXbtu7D/s8X3HnUIjaLGm0jW/OO6T GysU/G8TOMLfkbansyfMrmzklUR2+ZSO43bp8INTuRHrEVsLtzF2gshez7K5YsevsBq4 OBQrqBlEtSBkN7K3qfLJZYWzWH10bgHZAfHO/7CQzHVFi/yLsxegAP6RX6y4yaPuVH1w 5wl03usEfQXENP64W4g/2Fm+EIYODlYBcwf58rNHhwSex+FKtBzi5cZp9u956M6AUC11 mH2jC3m22JKqsXNbp7HLs72EutJXXPrUgdLdRYeVCHyKOPUopBX28SXGxEcy1mstESC/ 7cgw== Received: by 10.216.206.194 with SMTP id l44mr339594weo.125.1355216448868; Tue, 11 Dec 2012 01:00:48 -0800 (PST) Received: from luz3.lille.inria.fr ([193.51.236.232]) by mx.google.com with ESMTPS id b1sm15376748wix.11.2012.12.11.01.00.47 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Dec 2012 01:00:48 -0800 (PST) From: Damien Cassou To: notmuch@notmuchmail.org Subject: [PATCH 4/4] emacs: Add unit-tests for clickable tags Date: Tue, 11 Dec 2012 10:00:37 +0100 Message-Id: <1355216437-21109-5-git-send-email-damien.cassou@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1355216437-21109-1-git-send-email-damien.cassou@gmail.com> References: <1355216437-21109-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: Tue, 11 Dec 2012 09:00:54 -0000 Signed-off-by: Damien Cassou --- test/emacs | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/test/emacs b/test/emacs index 4e941bb..b7c5a93 100755 --- a/test/emacs +++ b/test/emacs @@ -840,5 +840,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