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 78911431FB6 for ; Mon, 10 Dec 2012 06:33:09 -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 rDqjQf32RBsR for ; Mon, 10 Dec 2012 06:33:07 -0800 (PST) Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 2382E431FBD for ; Mon, 10 Dec 2012 06:33:04 -0800 (PST) Received: by mail-wg0-f47.google.com with SMTP id dq11so1542058wgb.2 for ; Mon, 10 Dec 2012 06:33:02 -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=FjOPnjxam9eekRwg6h3Sr0akBYXL/OA/Zr+XVCAXZBs=; b=rKH2cY+s4o4E7Rso0VIfXu0LYf+VzalFsleWCofDp0ioWsuf6Kml+5O6vuYY3UDcDa E8xlOJIGw7UNeXI5vHWCYLLQ/rXRDkwOhk5AJoV0BfcifCTQ2GsrTsObeO0LmHQ7mcJp pJAmc43RNnlk7oAEH//hZMdObBlfYfMswvsGPeLYN6lCn20/rQ+XEl8IQ5yaAnN/2Nf4 +/3JnrO7W38VhCU6tLPFNPxq5uEtF7IThXDN5lw1TWRUwRNIVVvEqhQJqai0y06UJeUX xW+TG3tx+AMdvomOexFf0Z3Hb9Nu03KnZaspwLq6jsVibqnh1k/VSSNnTO9IztfKXot1 ZU9g== Received: by 10.216.141.86 with SMTP id f64mr5159071wej.38.1355149982851; Mon, 10 Dec 2012 06:33:02 -0800 (PST) Received: from luz3.lille.inria.fr ([193.51.236.232]) by mx.google.com with ESMTPS id i6sm10241253wix.5.2012.12.10.06.33.01 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Dec 2012 06:33:02 -0800 (PST) From: Damien Cassou To: notmuch@notmuchmail.org Subject: [PATCH 4/4] emacs: Add unit-tests for clickable tags Date: Mon, 10 Dec 2012 15:32:44 +0100 Message-Id: <1355149964-27905-5-git-send-email-damien.cassou@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1355149964-27905-1-git-send-email-damien.cassou@gmail.com> References: <1355149964-27905-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: Mon, 10 Dec 2012 14:33:09 -0000 Signed-off-by: Damien Cassou --- test/emacs | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/test/emacs b/test/emacs index 4e941bb..115f7d5 100755 --- a/test/emacs +++ b/test/emacs @@ -840,5 +840,67 @@ 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"' +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