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 4C517429E36 for ; Fri, 28 Oct 2011 20:05:08 -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 Cd9B-VHgMOlu for ; Fri, 28 Oct 2011 20:05:07 -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 B5019429E2E 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 p9T34x5T016362 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Sat, 29 Oct 2011 00:04:59 -0300 Received: from bremner by zancas.localnet with local (Exim 4.76) (envelope-from ) id 1RJzEB-0003DB-0w; Sat, 29 Oct 2011 00:04:59 -0300 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 1/4] notmuch-restore: add tests for new --match command line argument. Date: Sat, 29 Oct 2011 00:04:48 -0300 Message-Id: <1319857491-12298-2-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:08 -0000 From: David Bremner The syntax is notmuch restore --match=regex We check here that - missing regex fails - bad regex fails - good regex succeeds (at least the command line argument parsing). --- test/dump-restore | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/test/dump-restore b/test/dump-restore index 439e998..c176b52 100755 --- a/test/dump-restore +++ b/test/dump-restore @@ -50,9 +50,24 @@ test_expect_success 'Restore with nothing to do, III' \ test_cmp dump.expected dump.actual' # notmuch restore currently only considers the first argument. -test_expect_success 'Invalid restore invocation' \ +test_expect_success 'restore extra argument' \ 'test_must_fail notmuch restore dump.expected another_one' + +test_begin_subtest 'restore --match #missing arg' +test_subtest_known_broken +test_expect_equal "restore: option '--match' requires an argument"\ + "$(notmuch restore --match 2>&1)" + +test_begin_subtest 'restore --match=' +test_subtest_known_broken +test_expect_equal 'compiling regex notmuch.*[: Invalid regular expression'\ + "$(notmuch restore --match='notmuch.*[' 2>&1)" + +test_subtest_known_broken +test_expect_success 'restore --match=' \ + 'notmuch restore --match="notmuch.*" < /dev/null > /dev/null 2>&1' + test_begin_subtest "dump outfile" notmuch dump dump-outfile.actual test_expect_equal_file dump.expected dump-outfile.actual -- 1.7.6.3