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 8D329431FD9 for ; Sun, 18 Nov 2012 11:19:20 -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 hkAi37GSRPhZ for ; Sun, 18 Nov 2012 11:19:19 -0800 (PST) Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 47B97431FC0 for ; Sun, 18 Nov 2012 11:19:19 -0800 (PST) Received: by mail-wg0-f45.google.com with SMTP id dq11so838560wgb.2 for ; Sun, 18 Nov 2012 11:19:18 -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=nj3q2JpsNUsuL16wgy0vOFcU9kKkOap7H0SsyrmbHI8=; b=s7g1epXSl76TCRilcq23H1V4Jsrw1hdeWVXpPFZw+J4VZ/1e3L7cxrCx9tnfAP2p2V 6M3mdJ3ULJMGh2FeuDPtmiSy92+tYu9BSeE+JObBDnzciXw7HcSTILqWjzBl2uS56dGZ Do08hxAf1nvrPkM5KefgLSyPjFqKThb3hvl11BMzQuKFUNVVXc1PuwTMGYzuoIyX8KFQ qUNvrtapjDVTSWK1cp8CkPKBWRKg8ggTCta7yJRDJdN2Uu8nWVrhggT5qkIgVQDtYKh1 R3/68hzsC95rHhrvfYKbtKMCatSpyLRC839q5PnpClsFF0/FyqrBNsXRlAJSTlT5i5OF MT0w== Received: by 10.180.19.73 with SMTP id c9mr6031458wie.8.1353266358890; Sun, 18 Nov 2012 11:19:18 -0800 (PST) Received: from localhost.localdomain (ble59-4-82-228-190-150.fbx.proxad.net. [82.228.190.150]) by mx.google.com with ESMTPS id i2sm10290063wiw.3.2012.11.18.11.19.17 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Nov 2012 11:19:18 -0800 (PST) From: Damien Cassou To: notmuch mailing list Subject: [PATCH 4/4] emacs: Add unit-tests for clickable tags in notmuch-show Date: Sun, 18 Nov 2012 20:18:42 +0100 Message-Id: <1353266322-20318-5-git-send-email-damien.cassou@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1353266322-20318-1-git-send-email-damien.cassou@gmail.com> References: <1353266322-20318-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: Sun, 18 Nov 2012 19:19:20 -0000 Signed-off-by: Damien Cassou --- test/emacs | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/test/emacs b/test/emacs index 77265b0..2335bc4 100755 --- a/test/emacs +++ b/test/emacs @@ -813,5 +813,67 @@ test_emacs "(let ((mm-text-html-renderer test_expect_success "Rendering HTML mail with images" \ '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"' +parent=${gen_msg_id} +# Add tag "mytagfoo" to one of the emails +notmuch tag +mytagfoo id:${parent} +# 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 of notmuch-show emails are clickable" +add_message \ + '[subject]="foo bar"' \ + '[body]="body 1"' +parent=${gen_msg_id} +# Add tag "mytagfoo" to one of the emails +notmuch tag +mytagfoo id:${parent} +# 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_done -- 1.7.10.4