Re: [PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of all matching...
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Mon, 20 Feb 2012 12:25:05 +0000 (16:25 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:45 +0000 (09:44 -0800)
4b/5bafb54620fcad2f3c6ab536a457d36e3085b7 [new file with mode: 0644]

diff --git a/4b/5bafb54620fcad2f3c6ab536a457d36e3085b7 b/4b/5bafb54620fcad2f3c6ab536a457d36e3085b7
new file mode 100644 (file)
index 0000000..1e2c33b
--- /dev/null
@@ -0,0 +1,145 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id AADE0431FB6\r
+       for <notmuch@notmuchmail.org>; Mon, 20 Feb 2012 04:26:33 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id DTScGhMkz8ua for <notmuch@notmuchmail.org>;\r
+       Mon, 20 Feb 2012 04:26:29 -0800 (PST)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 9FB52431FAF\r
+       for <notmuch@notmuchmail.org>; Mon, 20 Feb 2012 04:26:29 -0800 (PST)\r
+Received: by bkcit16 with SMTP id it16so5126688bkc.26\r
+       for <notmuch@notmuchmail.org>; Mon, 20 Feb 2012 04:26:28 -0800 (PST)\r
+Received-SPF: pass (google.com: domain of dmitry.kurochkin@gmail.com\r
+       designates 10.205.124.15 as permitted sender)\r
+       client-ip=10.205.124.15; \r
+Authentication-Results: mr.google.com; spf=pass (google.com: domain of\r
+       dmitry.kurochkin@gmail.com designates 10.205.124.15 as\r
+       permitted sender) smtp.mail=dmitry.kurochkin@gmail.com;\r
+       dkim=pass header.i=dmitry.kurochkin@gmail.com\r
+Received: from mr.google.com ([10.205.124.15])\r
+       by 10.205.124.15 with SMTP id gm15mr11232888bkc.63.1329740788314\r
+       (num_hops = 1); Mon, 20 Feb 2012 04:26:28 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=u3g6yl/GdPPbZQJXPYaO8ekHMK5bq6oKeMeJXNf5ir0=;\r
+       b=LdzDYw3WPKOaEGGg5KbapuomNTVB89dc8Nl581vsLG+4dc93yCeO3Qmvehniy/o1at\r
+       wliVyMUnVeusMjc6yJEX4dFAXmmNw1WUySkiqQR31D8kldvgB8vxt6nHv6Rz/JrmqGEb\r
+       0tflBnmjnsFNk9JOsOAhLR3MH+GW0zHAeTvNQ=\r
+Received: by 10.205.124.15 with SMTP id gm15mr9059700bkc.63.1329740788242;\r
+       Mon, 20 Feb 2012 04:26:28 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id ut6sm38802833bkb.14.2012.02.20.04.26.27\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Mon, 20 Feb 2012 04:26:27 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: Pieter Praet <pieter@praet.org>, Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags\r
+       of all matching messages"\r
+In-Reply-To: <1329683908-5435-5-git-send-email-pieter@praet.org>\r
+References: <1310313335-4159-1-git-send-email-pieter@praet.org>\r
+       <1329683908-5435-1-git-send-email-pieter@praet.org>\r
+       <1329683908-5435-5-git-send-email-pieter@praet.org>\r
+User-Agent: Notmuch/0.11.1+188~ga5674c2 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Mon, 20 Feb 2012 16:25:05 +0400\r
+Message-ID: <87linxlmji.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 20 Feb 2012 12:26:33 -0000\r
+\r
+On Sun, 19 Feb 2012 21:38:28 +0100, Pieter Praet <pieter@praet.org> wrote:\r
+> `notmuch-search-tag-all' (bound to "*") adds and removes tags\r
+> to/from all messages which match the query used to populate the\r
+> current search buffer.\r
+\r
+LGTM.  But since you will need to send a new version to address Tomi's\r
+comments anyway, below are few minor comments.\r
+\r
+Regards,\r
+  Dmitry\r
+\r
+> ---\r
+>  test/emacs |   32 ++++++++++++++++++++++++++++++++\r
+>  1 files changed, 32 insertions(+), 0 deletions(-)\r
+> \r
+> diff --git a/test/emacs b/test/emacs\r
+> index b0fb760..1db8540 100755\r
+> --- a/test/emacs\r
+> +++ b/test/emacs\r
+> @@ -124,6 +124,38 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")\r
+>  output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)\r
+>  test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"\r
+>  \r
+> +test_begin_subtest "notmuch-search: change tags of all matching messages"\r
+> +old_tag="inbox"\r
+> +new_tag="xobni"\r
+> +filter="AND from:cworth"\r
+> +# Get initial tag counts and prevent false positives/negatives\r
+> +old_tag_count_1=$(notmuch count tag:"${old_tag}" "${filter}")\r
+> +new_tag_count_1=$(notmuch count tag:"${new_tag}" "${filter}")\r
+> +test "${old_tag_count_1}" == "0" && old_tag_count_1="Need 1+ matches!"\r
+\r
+Consider s/1+/>0/.\r
+\r
+> +test "${new_tag_count_1}" == "0" || new_tag_count_1="Need 0 matches!"\r
+> +# Change tags of all matching messages and get tag counts\r
+> +test_emacs "(notmuch-search \"tag:${old_tag} ${filter}\")\r
+> +        (notmuch-test-wait)\r
+> +        (notmuch-search-tag-all \"-${old_tag}\" \"+${new_tag}\")"\r
+> +old_tag_count_2=$(notmuch count tag:"${old_tag}" "${filter}")\r
+> +new_tag_count_2=$(notmuch count tag:"${new_tag}" "${filter}")\r
+> +# Revert tag changes and get tag counts\r
+> +test_emacs "(notmuch-search \"tag:${new_tag} ${filter}\")\r
+> +        (notmuch-test-wait)\r
+> +        (notmuch-search-tag-all \"+${old_tag}\" \"-${new_tag}\")"\r
+> +old_tag_count_3=$(notmuch count tag:"${old_tag}" "${filter}")\r
+> +new_tag_count_3=$(notmuch count tag:"${new_tag}" "${filter}")\r
+> +# ... and verify the results\r
+> +output="\r
+> +before:   old:${old_tag_count_1} new:${new_tag_count_1}\r
+> +after:    old:${old_tag_count_2} new:${new_tag_count_2}\r
+> +restored: old:${old_tag_count_3} new:${new_tag_count_3}"\r
+> +expected="\r
+> +before:   old:${old_tag_count_1} new:0\r
+> +after:    old:0 new:${old_tag_count_1}\r
+> +restored: old:${old_tag_count_1} new:0"\r
+> +test_expect_equal "$output" "$expected"\r
+> +\r
+\r
+I would add a newline before every commented block.\r
+\r
+Regards,\r
+  Dmitry\r
+\r
+>  test_begin_subtest "Message with .. in Message-Id:"\r
+>  add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'\r
+>  test_emacs '(notmuch-search "id:\"123..456@example\"")\r
+> -- \r
+> 1.7.8.1\r
+> \r