[PATCH v4 5/6] test: add some exclude tests
authorMark Walters <markwalters1009@gmail.com>
Sat, 7 Apr 2012 16:10:07 +0000 (17:10 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:06 +0000 (09:46 -0800)
e3/c457649bfa3de6da37d4ef5d8a6fcfe9112f96 [new file with mode: 0644]

diff --git a/e3/c457649bfa3de6da37d4ef5d8a6fcfe9112f96 b/e3/c457649bfa3de6da37d4ef5d8a6fcfe9112f96
new file mode 100644 (file)
index 0000000..79b32ab
--- /dev/null
@@ -0,0 +1,674 @@
+Return-Path: <markwalters1009@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 65E80431FD6\r
+       for <notmuch@notmuchmail.org>; Sat,  7 Apr 2012 09:11:06 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       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 uz6URSb-Zc4V for <notmuch@notmuchmail.org>;\r
+       Sat,  7 Apr 2012 09:10:57 -0700 (PDT)\r
+Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com\r
+ [74.125.82.45])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 76023431FAF   for <notmuch@notmuchmail.org>; Sat,  7 Apr 2012 09:10:57 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f45.google.com with SMTP id dt14so822285wgb.2\r
+       for <notmuch@notmuchmail.org>; Sat, 07 Apr 2012 09:10:57 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+       :mime-version:content-type:content-transfer-encoding;\r
+       bh=2Lp/8mioqNYXSDKEvYgI5JGga1T7YRvp8LKP5r6WM7M=;\r
+       b=BLCXr/aIV120mtYKUVwRkVd8MZyx3WjQ4b27Z6Gt1bSF11YpvuQ9n3lIrLrekKNAQt\r
+       Fk9mdwNd9VytruZhmdxgohqtpWSP6Acen2at9mvN6HCnBiDhxVNrftLcGHtl8AuDKEnS\r
+       buF9H5VyvnyapoZvfnbd+95yvd/PSgTxTuqkHxatBSbWJldQSH4AJklNG0IbZE+lZF8D\r
+       pnIxT+Iy4T4DTHiQ8XFVbDkrYxMa5ioL4rJdPzTvHrr0n/i3EdYpWWUZgqh/vl77H0Ul\r
+       JbFYtrhOZC6ZHzg2k1jdsCA3C8s3fUhlqdkYLqtTHDqXQDKNjbHCpatGzFuGHSx4UBBz\r
+       LtIA==\r
+Received: by 10.216.134.233 with SMTP id s83mr948414wei.104.1333815057076;\r
+       Sat, 07 Apr 2012 09:10:57 -0700 (PDT)\r
+Received: from localhost (94.197.17.51.threembb.co.uk. [94.197.17.51])\r
+       by mx.google.com with ESMTPS id h8sm25359069wix.4.2012.04.07.09.10.49\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sat, 07 Apr 2012 09:10:56 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 5/6] test: add some exclude tests\r
+Date: Sat,  7 Apr 2012 17:10:07 +0100\r
+Message-Id: <1333815008-24668-6-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1333815008-24668-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1333815008-24668-1-git-send-email-markwalters1009@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\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: Sat, 07 Apr 2012 16:11:06 -0000\r
+\r
+Systematically test the exclude options for search. Also move the\r
+search existing exclude tests into the new test. There is some overlap\r
+between the two sets of tests but many of the existing ones are there\r
+because they triggered bugs in the past so I have kept them to ensure\r
+coverage.\r
+---\r
+ test/count        |   21 ---\r
+ test/excludes     |  423 +++++++++++++++++++++++++++++++++++++++++++++++++++++\r
+ test/notmuch-test |    1 +\r
+ test/search       |   48 ------\r
+ 4 files changed, 424 insertions(+), 69 deletions(-)\r
+ create mode 100755 test/excludes\r
+\r
+diff --git a/test/count b/test/count\r
+index fd387e5..300b171 100755\r
+--- a/test/count\r
++++ b/test/count\r
+@@ -37,25 +37,4 @@ test_expect_equal \\r
+     "0" \\r
+     "`notmuch count --output=threads ${SEARCH}`"\r
+ \r
+-test_begin_subtest "count excluding \"deleted\" messages"\r
+-notmuch config set search.exclude_tags deleted\r
+-generate_message '[subject]="Not deleted"'\r
+-generate_message '[subject]="Another not deleted"'\r
+-generate_message '[subject]="Deleted"'\r
+-notmuch new > /dev/null\r
+-notmuch tag +deleted id:$gen_msg_id\r
+-test_expect_equal \\r
+-    "2" \\r
+-    "`notmuch count subject:deleted`"\r
+-\r
+-test_begin_subtest "count \"deleted\" messages, exclude overridden"\r
+-test_expect_equal \\r
+-    "1" \\r
+-    "`notmuch count subject:deleted and tag:deleted`"\r
+-\r
+-test_begin_subtest "count \"deleted\" messages, --exclude=false"\r
+-test_expect_equal \\r
+-    "3" \\r
+-    "`notmuch count --exclude=false subject:deleted`"\r
+-\r
+ test_done\r
+diff --git a/test/excludes b/test/excludes\r
+new file mode 100755\r
+index 0000000..24d653e\r
+--- /dev/null\r
++++ b/test/excludes\r
+@@ -0,0 +1,423 @@\r
++#!/usr/bin/env bash\r
++test_description='"notmuch search, count and show" with excludes in several variations'\r
++. ./test-lib.sh\r
++\r
++# Generates a thread consisting of a top level message and 'length'\r
++# replies. The subject of the top message 'subject: top message"\r
++# and the subject of the nth reply in the thread is "subject: reply n"\r
++generate_thread ()\r
++{\r
++    local subject="$1"\r
++    local length="$2"\r
++    generate_message '[subject]="'"${subject}: top message"'"' '[body]="'"body of top message"'"'\r
++    parent_id=$gen_msg_id\r
++    gen_thread_msg_id[0]=$gen_msg_id\r
++    for i in `seq 1 $length`\r
++    do\r
++      generate_message '[subject]="'"${subject}: reply $i"'"' \\r
++                       "[in-reply-to]=\<$parent_id\>" \\r
++                       '[body]="'"body of reply $i"'"'\r
++      gen_thread_msg_id[$i]=$gen_msg_id\r
++      parent_id=$gen_msg_id\r
++    done\r
++    notmuch new > /dev/null\r
++    # We cannot retrieve the thread_id until after we have run notmuch new.\r
++    gen_thread_id=`notmuch search --output=threads id:${gen_thread_msg_id[0]}`\r
++}\r
++\r
++#############################################\r
++# These are the original search exclude tests.\r
++\r
++test_begin_subtest "Search, exclude \"deleted\" messages from search"\r
++notmuch config set search.exclude_tags deleted\r
++generate_message '[subject]="Not deleted"'\r
++not_deleted_id=$gen_msg_id\r
++generate_message '[subject]="Deleted"'\r
++notmuch new > /dev/null\r
++notmuch tag +deleted id:$gen_msg_id\r
++deleted_id=$gen_msg_id\r
++output=$(notmuch search subject:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)"\r
++\r
++test_begin_subtest "Search, exclude \"deleted\" messages from message search"\r
++output=$(notmuch search --output=messages subject:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "id:$not_deleted_id"\r
++\r
++test_begin_subtest "Search, exclude \"deleted\" messages from message search --exclude=false"\r
++output=$(notmuch search --exclude=false --output=messages subject:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "id:$not_deleted_id\r
++id:$deleted_id"\r
++\r
++test_begin_subtest "Search, exclude \"deleted\" messages from message search (non-existent exclude-tag)"\r
++notmuch config set search.exclude_tags deleted non_existent_tag\r
++output=$(notmuch search --output=messages subject:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "id:$not_deleted_id"\r
++notmuch config set search.exclude_tags deleted\r
++\r
++test_begin_subtest "Search, exclude \"deleted\" messages from search, overridden"\r
++output=$(notmuch search subject:deleted and tag:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Deleted (deleted inbox unread)"\r
++\r
++test_begin_subtest "Search, exclude \"deleted\" messages from threads"\r
++add_message '[subject]="Not deleted reply"' '[in-reply-to]="<$gen_msg_id>"'\r
++output=$(notmuch search subject:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)\r
++thread:XXX   2001-01-05 [1/2] Notmuch Test Suite; Not deleted reply (deleted inbox unread)"\r
++\r
++test_begin_subtest "Search, don't exclude \"deleted\" messages when --exclude=flag specified"\r
++output=$(notmuch search --exclude=flag subject:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)\r
++thread:XXX   2001-01-05 [1/2] Notmuch Test Suite; Not deleted reply (deleted inbox unread)"\r
++\r
++test_begin_subtest "Search, don't exclude \"deleted\" messages from search if not configured"\r
++notmuch config set search.exclude_tags\r
++output=$(notmuch search subject:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)\r
++thread:XXX   2001-01-05 [2/2] Notmuch Test Suite; Deleted (deleted inbox unread)"\r
++\r
++\r
++########################################################\r
++# We construct some threads for the tests. We use the tag "test" to\r
++# indicate which messages we will search for.\r
++\r
++# A thread of deleted messages; test matches one of them.\r
++generate_thread "All messages excluded: single match" 5\r
++notmuch tag +deleted $gen_thread_id\r
++notmuch tag +test id:${gen_thread_msg_id[2]}\r
++\r
++# A thread of deleted messages; test matches two of them.\r
++generate_thread "All messages excluded: double match" 5\r
++notmuch tag +deleted $gen_thread_id\r
++notmuch tag +test id:${gen_thread_msg_id[2]}\r
++notmuch tag +test id:${gen_thread_msg_id[4]}\r
++\r
++# A thread some messages deleted; test only matches a deleted message.\r
++generate_thread "Some messages excluded: single excluded match" 5\r
++notmuch tag +deleted +test id:${gen_thread_msg_id[3]}\r
++\r
++# A thread some messages deleted; test only matches a non-deleted message.\r
++generate_thread "Some messages excluded: single non-excluded match" 5\r
++notmuch tag +deleted id:${gen_thread_msg_id[2]}\r
++notmuch tag +test id:${gen_thread_msg_id[4]}\r
++\r
++# A thread no messages deleted; test matches a message.\r
++generate_thread "No messages excluded: single match" 5\r
++notmuch tag +test id:${gen_thread_msg_id[3]}\r
++\r
++# Temporarily remove excludes to get list of matching messages\r
++notmuch config set search.exclude_tags\r
++matching_message_ids=( `notmuch search --output=messages tag:test` )\r
++notmuch config set search.exclude_tags deleted\r
++\r
++#########################################\r
++# Notmuch search tests\r
++\r
++test_begin_subtest "Search, default exclusion (thread summary)"\r
++output=$(notmuch search tag:test | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; Some messages excluded: single non-excluded match: reply 4 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; No messages excluded: single match: reply 3 (inbox test unread)"\r
++\r
++test_begin_subtest "Search, default exclusion (messages)"\r
++output=$(notmuch search --output=messages tag:test | notmuch_search_sanitize)\r
++test_expect_equal "$output" "${matching_message_ids[4]}\r
++${matching_message_ids[5]}"\r
++\r
++test_begin_subtest "Search, exclude=true (thread summary)"\r
++output=$(notmuch search --exclude=true tag:test | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; Some messages excluded: single non-excluded match: reply 4 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; No messages excluded: single match: reply 3 (inbox test unread)"\r
++\r
++test_begin_subtest "Search, exclude=true (messages)"\r
++output=$(notmuch search --exclude=true --output=messages tag:test | notmuch_search_sanitize)\r
++test_expect_equal "$output" "${matching_message_ids[4]}\r
++${matching_message_ids[5]}"\r
++\r
++test_begin_subtest "Search, exclude=false (thread summary)"\r
++output=$(notmuch search --exclude=false tag:test | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; All messages excluded: single match: reply 2 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [2/6] Notmuch Test Suite; All messages excluded: double match: reply 2 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; Some messages excluded: single excluded match: reply 3 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; Some messages excluded: single non-excluded match: reply 4 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; No messages excluded: single match: reply 3 (inbox test unread)"\r
++\r
++test_begin_subtest "Search, exclude=false (messages)"\r
++output=$(notmuch search --exclude=false --output=messages tag:test | notmuch_search_sanitize)\r
++test_expect_equal "$output" "${matching_message_ids[0]}\r
++${matching_message_ids[1]}\r
++${matching_message_ids[2]}\r
++${matching_message_ids[3]}\r
++${matching_message_ids[4]}\r
++${matching_message_ids[5]}"\r
++\r
++test_begin_subtest "Search, exclude=flag (thread summary)"\r
++output=$(notmuch search --exclude=flag tag:test | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [0/6] Notmuch Test Suite; All messages excluded: single match: reply 2 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [0/6] Notmuch Test Suite; All messages excluded: double match: reply 4 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [0/6] Notmuch Test Suite; Some messages excluded: single excluded match: reply 3 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; Some messages excluded: single non-excluded match: reply 4 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; No messages excluded: single match: reply 3 (inbox test unread)"\r
++\r
++test_begin_subtest "Search, exclude=flag (messages)"\r
++output=$(notmuch search --exclude=flag --output=messages tag:test | notmuch_search_sanitize)\r
++test_expect_equal "$output" "${matching_message_ids[0]}\r
++${matching_message_ids[1]}\r
++${matching_message_ids[2]}\r
++${matching_message_ids[3]}\r
++${matching_message_ids[4]}\r
++${matching_message_ids[5]}"\r
++\r
++test_begin_subtest "Search, default exclusion: tag in query (thread summary)"\r
++output=$(notmuch search tag:test and tag:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; All messages excluded: single match: reply 2 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [2/6] Notmuch Test Suite; All messages excluded: double match: reply 2 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; Some messages excluded: single excluded match: reply 3 (deleted inbox test unread)"\r
++\r
++test_begin_subtest "Search, default exclusion: tag in query (messages)"\r
++output=$(notmuch search --output=messages tag:test and tag:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "${matching_message_ids[0]}\r
++${matching_message_ids[1]}\r
++${matching_message_ids[2]}\r
++${matching_message_ids[3]}"\r
++\r
++test_begin_subtest "Search, exclude=true: tag in query (thread summary)"\r
++output=$(notmuch search --exclude=true tag:test and tag:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; All messages excluded: single match: reply 2 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [2/6] Notmuch Test Suite; All messages excluded: double match: reply 2 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; Some messages excluded: single excluded match: reply 3 (deleted inbox test unread)"\r
++\r
++test_begin_subtest "Search, exclude=true: tag in query (messages)"\r
++output=$(notmuch search --exclude=true --output=messages tag:test and tag:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "${matching_message_ids[0]}\r
++${matching_message_ids[1]}\r
++${matching_message_ids[2]}\r
++${matching_message_ids[3]}"\r
++\r
++test_begin_subtest "Search, exclude=false: tag in query (thread summary)"\r
++output=$(notmuch search --exclude=false tag:test and tag:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; All messages excluded: single match: reply 2 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [2/6] Notmuch Test Suite; All messages excluded: double match: reply 2 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; Some messages excluded: single excluded match: reply 3 (deleted inbox test unread)"\r
++\r
++test_begin_subtest "Search, exclude=false: tag in query (messages)"\r
++output=$(notmuch search --exclude=false --output=messages tag:test and tag:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "${matching_message_ids[0]}\r
++${matching_message_ids[1]}\r
++${matching_message_ids[2]}\r
++${matching_message_ids[3]}"\r
++\r
++test_begin_subtest "Search, exclude=flag: tag in query (thread summary)"\r
++output=$(notmuch search --exclude=flag tag:test and tag:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; All messages excluded: single match: reply 2 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [2/6] Notmuch Test Suite; All messages excluded: double match: reply 2 (deleted inbox test unread)\r
++thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; Some messages excluded: single excluded match: reply 3 (deleted inbox test unread)"\r
++\r
++test_begin_subtest "Search, exclude=flag: tag in query (messages)"\r
++output=$(notmuch search --exclude=flag --output=messages tag:test and tag:deleted | notmuch_search_sanitize)\r
++test_expect_equal "$output" "${matching_message_ids[0]}\r
++${matching_message_ids[1]}\r
++${matching_message_ids[2]}\r
++${matching_message_ids[3]}"\r
++\r
++\r
++#########################################################\r
++# Notmuch count tests\r
++\r
++test_begin_subtest "Count, default exclusion (messages)"\r
++output=$(notmuch count tag:test)\r
++test_expect_equal "$output" "2"\r
++\r
++test_begin_subtest "Count, default exclusion (threads)"\r
++output=$(notmuch count --output=threads tag:test)\r
++test_expect_equal "$output" "2"\r
++\r
++test_begin_subtest "Count, exclude=true (messages)"\r
++output=$(notmuch count --exclude=true tag:test)\r
++test_expect_equal "$output" "2"\r
++\r
++test_begin_subtest "Count, exclude=true (threads)"\r
++output=$(notmuch count --output=threads --exclude=true tag:test)\r
++test_expect_equal "$output" "2"\r
++\r
++test_begin_subtest "Count, exclude=false (messages)"\r
++output=$(notmuch count --exclude=false tag:test)\r
++test_expect_equal "$output" "6"\r
++\r
++test_begin_subtest "Count, exclude=false (threads)"\r
++output=$(notmuch count --output=threads --exclude=false tag:test)\r
++test_expect_equal "$output" "5"\r
++\r
++test_begin_subtest "Count, default exclusion: tag in query (messages)"\r
++output=$(notmuch count tag:test and tag:deleted)\r
++test_expect_equal "$output" "4"\r
++\r
++test_begin_subtest "Count, default exclusion: tag in query (threads)"\r
++output=$(notmuch count --output=threads tag:test and tag:deleted)\r
++test_expect_equal "$output" "3"\r
++\r
++test_begin_subtest "Count, exclude=true: tag in query (messages)"\r
++output=$(notmuch count --exclude=true tag:test and tag:deleted)\r
++test_expect_equal "$output" "4"\r
++\r
++test_begin_subtest "Count, exclude=true: tag in query (threads)"\r
++output=$(notmuch count --output=threads --exclude=true tag:test and tag:deleted)\r
++test_expect_equal "$output" "3"\r
++\r
++test_begin_subtest "Count, exclude=false: tag in query (messages)"\r
++output=$(notmuch count --exclude=false tag:test and tag:deleted)\r
++test_expect_equal "$output" "4"\r
++\r
++test_begin_subtest "Count, exclude=false: tag in query (threads)"\r
++output=$(notmuch count --output=threads --exclude=false tag:test and tag:deleted)\r
++test_expect_equal "$output" "3"\r
++\r
++#############################################################\r
++# Show tests\r
++\r
++test_begin_subtest "Show, default exclusion"\r
++output=$(notmuch show tag:test | notmuch_show_sanitize_all | egrep "Subject:|message{")\r
++test_expect_equal "$output" "\f\r
+message{ id:XXXXX depth:0 match:1 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 4\r
++\f\r
+message{ id:XXXXX depth:0 match:1 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 3"\r
++\r
++test_begin_subtest "Show, default exclusion (entire-thread)"\r
++output=$(notmuch show --entire-thread tag:test | notmuch_show_sanitize_all | egrep "Subject:|message{")\r
++test_expect_equal "$output" "\f\r
+message{ id:XXXXX depth:0 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: top message\r
++\f\r
+message{ id:XXXXX depth:1 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 1\r
++\f\r
+message{ id:XXXXX depth:2 match:0 excluded:1 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 2\r
++\f\r
+message{ id:XXXXX depth:3 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 3\r
++\f\r
+message{ id:XXXXX depth:4 match:1 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 4\r
++\f\r
+message{ id:XXXXX depth:5 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 5\r
++\f\r
+message{ id:XXXXX depth:0 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: top message\r
++\f\r
+message{ id:XXXXX depth:1 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 1\r
++\f\r
+message{ id:XXXXX depth:2 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 2\r
++\f\r
+message{ id:XXXXX depth:3 match:1 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 3\r
++\f\r
+message{ id:XXXXX depth:4 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 4\r
++\f\r
+message{ id:XXXXX depth:5 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 5"\r
++\r
++test_begin_subtest "Show, exclude=true"\r
++output=$(notmuch show --exclude=true tag:test | notmuch_show_sanitize_all | egrep "Subject:|message{")\r
++test_expect_equal "$output" "\f\r
+message{ id:XXXXX depth:0 match:1 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 4\r
++\f\r
+message{ id:XXXXX depth:0 match:1 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 3"\r
++\r
++test_begin_subtest "Show, exclude=true (entire-thread)"\r
++output=$(notmuch show --entire-thread --exclude=true tag:test | notmuch_show_sanitize_all | egrep "Subject:|message{")\r
++test_expect_equal "$output" "\f\r
+message{ id:XXXXX depth:0 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: top message\r
++\f\r
+message{ id:XXXXX depth:1 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 1\r
++\f\r
+message{ id:XXXXX depth:2 match:0 excluded:1 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 2\r
++\f\r
+message{ id:XXXXX depth:3 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 3\r
++\f\r
+message{ id:XXXXX depth:4 match:1 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 4\r
++\f\r
+message{ id:XXXXX depth:5 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 5\r
++\f\r
+message{ id:XXXXX depth:0 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: top message\r
++\f\r
+message{ id:XXXXX depth:1 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 1\r
++\f\r
+message{ id:XXXXX depth:2 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 2\r
++\f\r
+message{ id:XXXXX depth:3 match:1 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 3\r
++\f\r
+message{ id:XXXXX depth:4 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 4\r
++\f\r
+message{ id:XXXXX depth:5 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 5"\r
++\r
++test_begin_subtest "Show, exclude=false"\r
++output=$(notmuch show --exclude=false tag:test | notmuch_show_sanitize_all  | egrep "Subject:|message{")\r
++test_expect_equal "$output" "\f\r
+message{ id:XXXXX depth:0 match:1 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: single match: reply 2\r
++\f\r
+message{ id:XXXXX depth:0 match:1 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: double match: reply 2\r
++\f\r
+message{ id:XXXXX depth:1 match:1 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: double match: reply 4\r
++\f\r
+message{ id:XXXXX depth:0 match:1 excluded:1 filename:XXXXX\r
++Subject: Some messages excluded: single excluded match: reply 3\r
++\f\r
+message{ id:XXXXX depth:0 match:1 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 4\r
++\f\r
+message{ id:XXXXX depth:0 match:1 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 3"\r
++\r
++test_begin_subtest "Show, exclude=false (entire-thread)"\r
++output=$(notmuch show --entire-thread --exclude=false tag:test | notmuch_show_sanitize_all | egrep "Subject:|message{")\r
++test_expect_equal "$output" "\f\r
+message{ id:XXXXX depth:0 match:0 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: single match: top message\r
++\f\r
+message{ id:XXXXX depth:1 match:0 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: single match: reply 1\r
++\f\r
+message{ id:XXXXX depth:2 match:1 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: single match: reply 2\r
++\f\r
+message{ id:XXXXX depth:3 match:0 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: single match: reply 3\r
++\f\r
+message{ id:XXXXX depth:4 match:0 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: single match: reply 4\r
++\f\r
+message{ id:XXXXX depth:5 match:0 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: single match: reply 5\r
++\f\r
+message{ id:XXXXX depth:0 match:0 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: double match: top message\r
++\f\r
+message{ id:XXXXX depth:1 match:0 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: double match: reply 1\r
++\f\r
+message{ id:XXXXX depth:2 match:1 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: double match: reply 2\r
++\f\r
+message{ id:XXXXX depth:3 match:0 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: double match: reply 3\r
++\f\r
+message{ id:XXXXX depth:4 match:1 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: double match: reply 4\r
++\f\r
+message{ id:XXXXX depth:5 match:0 excluded:1 filename:XXXXX\r
++Subject: All messages excluded: double match: reply 5\r
++\f\r
+message{ id:XXXXX depth:0 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single excluded match: top message\r
++\f\r
+message{ id:XXXXX depth:1 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single excluded match: reply 1\r
++\f\r
+message{ id:XXXXX depth:2 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single excluded match: reply 2\r
++\f\r
+message{ id:XXXXX depth:3 match:1 excluded:1 filename:XXXXX\r
++Subject: Some messages excluded: single excluded match: reply 3\r
++\f\r
+message{ id:XXXXX depth:4 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single excluded match: reply 4\r
++\f\r
+message{ id:XXXXX depth:5 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single excluded match: reply 5\r
++\f\r
+message{ id:XXXXX depth:0 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: top message\r
++\f\r
+message{ id:XXXXX depth:1 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 1\r
++\f\r
+message{ id:XXXXX depth:2 match:0 excluded:1 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 2\r
++\f\r
+message{ id:XXXXX depth:3 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 3\r
++\f\r
+message{ id:XXXXX depth:4 match:1 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 4\r
++\f\r
+message{ id:XXXXX depth:5 match:0 excluded:0 filename:XXXXX\r
++Subject: Some messages excluded: single non-excluded match: reply 5\r
++\f\r
+message{ id:XXXXX depth:0 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: top message\r
++\f\r
+message{ id:XXXXX depth:1 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 1\r
++\f\r
+message{ id:XXXXX depth:2 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 2\r
++\f\r
+message{ id:XXXXX depth:3 match:1 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 3\r
++\f\r
+message{ id:XXXXX depth:4 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 4\r
++\f\r
+message{ id:XXXXX depth:5 match:0 excluded:0 filename:XXXXX\r
++Subject: No messages excluded: single match: reply 5"\r
++\r
++\r
++test_done\r
+diff --git a/test/notmuch-test b/test/notmuch-test\r
+index f03b594..801df73 100755\r
+--- a/test/notmuch-test\r
++++ b/test/notmuch-test\r
+@@ -27,6 +27,7 @@ TESTS="\r
+   search-position-overlap-bug\r
+   search-insufficient-from-quoting\r
+   search-limiting\r
++  excludes\r
+   tagging\r
+   json\r
+   multipart\r
+diff --git a/test/search b/test/search\r
+index 17af6a2..a7a0b18 100755\r
+--- a/test/search\r
++++ b/test/search\r
+@@ -129,52 +129,4 @@ add_message '[subject]="utf8-message-body-subject"' '[date]="Sat, 01 Jan 2000 12\r
+ output=$(notmuch search "bödý" | notmuch_search_sanitize)\r
+ test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; utf8-message-body-subject (inbox unread)"\r
+ \r
+-test_begin_subtest "Exclude \"deleted\" messages from search"\r
+-notmuch config set search.exclude_tags deleted\r
+-generate_message '[subject]="Not deleted"'\r
+-not_deleted_id=$gen_msg_id\r
+-generate_message '[subject]="Deleted"'\r
+-notmuch new > /dev/null\r
+-notmuch tag +deleted id:$gen_msg_id\r
+-deleted_id=$gen_msg_id\r
+-output=$(notmuch search subject:deleted | notmuch_search_sanitize)\r
+-test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)\r
+-thread:XXX   2001-01-05 [0/1] Notmuch Test Suite; Deleted (deleted inbox unread)"\r
+-\r
+-test_begin_subtest "Exclude \"deleted\" messages from message search"\r
+-output=$(notmuch search --output=messages subject:deleted | notmuch_search_sanitize)\r
+-test_expect_equal "$output" "id:$not_deleted_id"\r
+-\r
+-test_begin_subtest "Exclude \"deleted\" messages from message search (no-exclude)"\r
+-output=$(notmuch search --no-exclude --output=messages subject:deleted | notmuch_search_sanitize)\r
+-test_expect_equal "$output" "id:$not_deleted_id\r
+-id:$deleted_id"\r
+-\r
+-test_begin_subtest "Exclude \"deleted\" messages from message search (non-existent exclude-tag)"\r
+-notmuch config set search.exclude_tags deleted non_existent_tag\r
+-output=$(notmuch search --output=messages subject:deleted | notmuch_search_sanitize)\r
+-test_expect_equal "$output" "id:$not_deleted_id"\r
+-notmuch config set search.exclude_tags deleted\r
+-\r
+-test_begin_subtest "Exclude \"deleted\" messages from search, overridden"\r
+-output=$(notmuch search subject:deleted and tag:deleted | notmuch_search_sanitize)\r
+-test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Deleted (deleted inbox unread)"\r
+-\r
+-test_begin_subtest "Exclude \"deleted\" messages from threads"\r
+-add_message '[subject]="Not deleted reply"' '[in-reply-to]="<$gen_msg_id>"'\r
+-output=$(notmuch search subject:deleted | notmuch_search_sanitize)\r
+-test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)\r
+-thread:XXX   2001-01-05 [1/2] Notmuch Test Suite; Not deleted reply (deleted inbox unread)"\r
+-\r
+-test_begin_subtest "Don't exclude \"deleted\" messages when --no-exclude specified"\r
+-output=$(notmuch search --no-exclude subject:deleted | notmuch_search_sanitize)\r
+-test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)\r
+-thread:XXX   2001-01-05 [2/2] Notmuch Test Suite; Deleted (deleted inbox unread)"\r
+-\r
+-test_begin_subtest "Don't exclude \"deleted\" messages from search if not configured"\r
+-notmuch config set search.exclude_tags\r
+-output=$(notmuch search subject:deleted | notmuch_search_sanitize)\r
+-test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)\r
+-thread:XXX   2001-01-05 [2/2] Notmuch Test Suite; Deleted (deleted inbox unread)"\r
+-\r
+ test_done\r
+-- \r
+1.7.9.1\r
+\r