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 32748429E2E for ; Fri, 28 Oct 2011 20:05:10 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] 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 w01V3cl-J0Sw for ; Fri, 28 Oct 2011 20:05:08 -0700 (PDT) Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E1EE9429E30 for ; Fri, 28 Oct 2011 20:05:03 -0700 (PDT) Received: from zancas.localnet (fctnnbsc36w-156034064058.pppoe-dynamic.High-Speed.nb.bellaliant.net [156.34.64.58]) (authenticated bits=0) by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id p9T34x81016364 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Sat, 29 Oct 2011 00:05:00 -0300 Received: from bremner by zancas.localnet with local (Exim 4.76) (envelope-from ) id 1RJzEB-0003DG-3m; Sat, 29 Oct 2011 00:04:59 -0300 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 3/4] test/dump-restore: add tests for notmuch restore --match Date: Sat, 29 Oct 2011 00:04:50 -0300 Message-Id: <1319857491-12298-4-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.7.6.3 In-Reply-To: <1319857491-12298-1-git-send-email-david@tethera.net> References: <1319406673-7208-1-git-send-email-david@tethera.net> <1319857491-12298-1-git-send-email-david@tethera.net> Cc: David Bremner 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, 29 Oct 2011 03:05:10 -0000 From: David Bremner The first test passes now because it only needs command line parsing. The other three are marked broken, with functionality to follow. --- test/dump-restore | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/test/dump-restore b/test/dump-restore index c6089f9..18925a4 100755 --- a/test/dump-restore +++ b/test/dump-restore @@ -65,6 +65,49 @@ test_expect_equal 'compiling regex notmuch.*[: Invalid regular expression'\ test_expect_success 'restore --match=' \ 'notmuch restore --match="notmuch.*" < /dev/null > /dev/null 2>&1' +test_expect_success 'Restoring with trivial match' \ + 'notmuch restore --match="." dump.expected && + notmuch dump > dump.actual && + test_cmp dump.expected dump.actual' + +sed 's/inbox\|unread\|signed//g' < dump-ABC_DEF.expected > dump-ABC_DEF-only + +test_subtest_known_broken +test_expect_success 'Simulate accumulate with match' \ + 'notmuch restore < dump.expected && + notmuch restore --match="(ABC|DEF)" < dump-ABC_DEF-only && + notmuch dump > dump-simulate.actual && + notmuch restore < dump.expected && + test_cmp dump-ABC_DEF.expected dump-simulate.actual' + +test_subtest_known_broken +test_expect_success 'clear only matched tags' \ + 'notmuch restore < dump-ABC_DEF.expected && + notmuch restore --match="(ABC|DEF)" < clear.expected && + notmuch dump > dump-clear-match.actual && + notmuch restore < dump.expected && + test_cmp dump.expected dump-clear-match.actual' + +test_subtest_known_broken +test_expect_success 'import only matched tags' \ + 'notmuch restore < dump.expected && + notmuch restore --match="(inbox|unread)" < dump-ABC_DEF.expected && + notmuch dump > dump-import-match.actual && + notmuch restore < dump.expected && + test_cmp dump.expected dump-import-match.actual' + +sed 's/inbox\|unread\|signed\|ABC//g' < dump-ABC_DEF.expected > dump-DEF-only +sed 's/inbox\|unread\|signed\|DEF//g' < dump-ABC_DEF.expected > dump-ABC-only + +test_subtest_known_broken +test_expect_success 'combine --match and --accumulate' \ + 'notmuch restore < dump.expected && + notmuch restore --match="(ABC|DEF)" < dump-ABC-only && + notmuch restore --accumulate --match="(ABC|DEF)" < dump-DEF-only && + notmuch dump > dump-combine-match.actual && + notmuch restore < dump.expected && + test_cmp dump-ABC_DEF.expected dump-combine-match.actual' + test_begin_subtest "dump outfile" notmuch dump dump-outfile.actual test_expect_equal_file dump.expected dump-outfile.actual -- 1.7.6.3