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 EE690429E27 for ; Mon, 7 Nov 2011 19:54:41 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[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 e-xwV5qHVo68 for ; Mon, 7 Nov 2011 19:54:41 -0800 (PST) Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU [18.7.68.36]) by olra.theworths.org (Postfix) with ESMTP id 67B34431FB6 for ; Mon, 7 Nov 2011 19:54:41 -0800 (PST) X-AuditID: 12074424-b7ef76d0000008dc-1c-4eb8a80041bf Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP id 74.DC.02268.008A8BE4; Mon, 7 Nov 2011 22:54:40 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id pA83seC4030566; Mon, 7 Nov 2011 22:54:40 -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 pA83sd8X007121 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 7 Nov 2011 22:54:39 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1RNcoG-0006A6-1P; Mon, 07 Nov 2011 22:57:16 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH] test: Add a test script for "notmuch tag" Date: Mon, 7 Nov 2011 22:57:11 -0500 Message-Id: <1320724631-23643-1-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.7.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprJIsWRmVeSWpSXmKPExsUixG6nrsuwYoefwfYLVhbXb85kdmD0eLbq FnMAYxSXTUpqTmZZapG+XQJXxsWjF1gLZgpXrN2/l62B8Rt/FyMnh4SAicTcfc2sELaYxIV7 69m6GLk4hAT2MUpM2r6cBcJZzyjxYc5SVgjnBJPE2sfrmUBahAQ2M0p83GoCYrMJaEhs27+c EcQWEZCW2Hl3NlADBwezgJrEny4VkLCwgJXE7XNXWUBsFgFViQtnT7KD2LwCDhITzxxjBCmX EFCQWLajegIj7wJGhlWMsim5Vbq5iZk5xanJusXJiXl5qUW65nq5mSV6qSmlmxjBIeCisoOx +ZDSIUYBDkYlHt6Zojv8hFgTy4orcw8xSnIwKYnyxi8FCvEl5adUZiQWZ8QXleakFh9ilOBg VhLhVWoCyvGmJFZWpRblw6SkOViUxHltdjr4CQmkJ5akZqemFqQWwWRlODiUJHiPLANqFCxK TU+tSMvMKUFIM3FwggznARp+EqSGt7ggMbc4Mx0if4pRUUqcV245UEIAJJFRmgfXC4vRV4zi QK8I8/4GaecBxjdc9yugwUxAg9t1t4EMLklESEk1MFY4lEXK7lLMqdp85asVY/5bDv9TDzpv KXfrTa1S3Grz7/RMlT3bRdiab/PuqVr2YbXebZ2DZ867W1iVVHsp29kdkVojxcWztajXhDsx XZTh0JyFlw/NdvqzzNWdpzP19L+1Vzc2nVz14Z+d2sx35vzPpq/0W3Jhf2v9P43njjFND36Z MctHJymxFGckGmoxFxUnAgAAl3IGrAIAAA== 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: Tue, 08 Nov 2011 03:54:42 -0000 --- This is, in principle, unrelated to the notmuch tag optimization I just sent out, though it does test some things that would be weird (though valid) to test if it weren't for that optimization. test/notmuch-test | 1 + test/tagging | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 0 deletions(-) create mode 100755 test/tagging diff --git a/test/notmuch-test b/test/notmuch-test index 738f8f6..bbabf28 100755 --- a/test/notmuch-test +++ b/test/notmuch-test @@ -24,6 +24,7 @@ TESTS=" search-by-folder search-position-overlap-bug search-insufficient-from-quoting + tagging json multipart thread-naming diff --git a/test/tagging b/test/tagging new file mode 100755 index 0000000..77202bf --- /dev/null +++ b/test/tagging @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +test_description='"notmuch tag"' +. ./test-lib.sh + +add_message '[subject]=One' +add_message '[subject]=Two' + +test_begin_subtest "Adding tags" +notmuch tag +tag1 +tag2 +tag3 \* +output=$(notmuch search \* | notmuch_search_sanitize) +test_expect_equal "$output" "\ +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 tag2 tag3 unread) +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag2 tag3 unread)" + +test_begin_subtest "Removing tags" +notmuch tag -tag1 -tag2 \* +output=$(notmuch search \* | notmuch_search_sanitize) +test_expect_equal "$output" "\ +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag3 unread) +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag3 unread)" + +test_expect_code 1 "No tag operations" 'notmuch tag One' +test_expect_code 1 "No query" 'notmuch tag +tag2' + +test_begin_subtest "Redundant tagging" +notmuch tag +tag1 -tag3 One +notmuch tag +tag1 -tag3 \* +output=$(notmuch search \* | notmuch_search_sanitize) +test_expect_equal "$output" "\ +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread) +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 unread)" + +test_begin_subtest "Special characters in tags" +notmuch tag +':" ' \* +notmuch tag -':" ' Two +output=$(notmuch search \* | notmuch_search_sanitize) +test_expect_equal "$output" "\ +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (:\" inbox tag1 unread) +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 unread)" + +test_done -- 1.7.7.1