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