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 394A6431FD0 for ; Mon, 24 Jan 2011 09:18:28 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_NONE=-0.0001] 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 BE4GEnc+LTPY for ; Mon, 24 Jan 2011 09:18:27 -0800 (PST) Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU [18.7.68.34]) by olra.theworths.org (Postfix) with ESMTP id DBAAE431FB6 for ; Mon, 24 Jan 2011 09:18:26 -0800 (PST) X-AuditID: 12074422-b7c3eae000000a70-c8-4d3db462e8c1 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-5.mit.edu (Symantec Brightmail Gateway) with SMTP id 02.3B.02672.264BD3D4; Mon, 24 Jan 2011 12:18:26 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id p0OHIPhM021759; Mon, 24 Jan 2011 12:18:25 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p0OHIONr017270 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 24 Jan 2011 12:18:25 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.72) (envelope-from ) id 1PhQ3c-0000IE-QY; Mon, 24 Jan 2011 12:18:24 -0500 Date: Mon, 24 Jan 2011 12:18:24 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 6.5/8] test: Add tests for custom query parser-based folder searches. Message-ID: <20110124171824.GQ13226@mit.edu> References: <1295165458-9573-1-git-send-email-amdragon@mit.edu> <1295165458-9573-7-git-send-email-amdragon@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1295165458-9573-7-git-send-email-amdragon@mit.edu> User-Agent: Mutt/1.5.20 (2009-06-14) X-Brightmail-Tracker: AAAAARczUFs= Cc: amdragon@mit.edu 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, 24 Jan 2011 17:18:28 -0000 --- test/notmuch-test | 2 +- test/search-by-folder | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletions(-) create mode 100755 test/search-by-folder diff --git a/test/notmuch-test b/test/notmuch-test index 1e331b3..2aa3489 100755 --- a/test/notmuch-test +++ b/test/notmuch-test @@ -16,7 +16,7 @@ fi cd $(dirname "$0") -TESTS="basic new qparser search search-output json thread-naming raw reply dump-restore uuencode thread-order author-order from-guessing long-id encoding emacs maildir-sync" +TESTS="basic new qparser search search-output search-by-folder json thread-naming raw reply dump-restore uuencode thread-order author-order from-guessing long-id encoding emacs maildir-sync" # Clean up any results from a previous run rm -r test-results >/dev/null 2>/dev/null diff --git a/test/search-by-folder b/test/search-by-folder new file mode 100755 index 0000000..ebf724f --- /dev/null +++ b/test/search-by-folder @@ -0,0 +1,52 @@ +#!/bin/bash +test_description='"notmuch search" by folder: (with variations)' +. ./test-lib.sh + +add_message '[dir]=bad' '[subject]="To the bone"' +add_message '[dir]=bad/news' '[subject]="Bears"' +mkdir -p "${MAIL_DIR}/duplicate/bad/news" +cp "$gen_msg_filename" "${MAIL_DIR}/duplicate/bad/news" + +add_message '[dir]=things' '[subject]="These are a few"' +add_message '[dir]=things/favorite' '[subject]="Raindrops, whiskers, kettles"' +add_message '[dir]=things/bad' '[subject]="Bites, stings, sad feelings"' + +test_begin_subtest "Top-level folder" +output=$(notmuch search folder:bad | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; To the bone (inbox unread)" + +test_begin_subtest "Nested folder" +output=$(notmuch search folder:bad/news | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)" + +test_begin_subtest "Search is rooted" +output=$(notmuch search folder:news | notmuch_search_sanitize) +test_expect_equal "$output" "" + +test_begin_subtest "Absolute path" +output=$(notmuch search folder:$MAIL_DIR/bad | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; To the bone (inbox unread)" + +test_begin_subtest "Duplicate path" +output=$(notmuch search folder:duplicate/bad/news | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)" + +test_begin_subtest "After removing duplicate instance of matching path" +rm -r "${MAIL_DIR}/bad/news" +increment_mtime "${MAIL_DIR}/bad" +notmuch new +output=$(notmuch search folder:duplicate/bad/news | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)" + +test_begin_subtest "After rename, old path returns nothing" +mv "${MAIL_DIR}/duplicate/bad/news" "${MAIL_DIR}/duplicate/bad/olds" +increment_mtime "${MAIL_DIR}/duplicate/bad" +notmuch new +output=$(notmuch search folder:duplicate/bad/news | notmuch_search_sanitize) +test_expect_equal "$output" "" + +test_begin_subtest "After rename, new path returns result" +output=$(notmuch search folder:duplicate/bad/olds | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)" + +test_done -- 1.7.2.3