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 7B798429E31 for ; Sat, 14 Mar 2015 10:05:36 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 2.438 X-Spam-Level: ** X-Spam-Status: No, score=2.438 tagged_above=-999 required=5 tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 HooVhyqh6GO9 for ; Sat, 14 Mar 2015 10:05:36 -0700 (PDT) Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net [87.98.215.224]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 0D08A429E30 for ; Sat, 14 Mar 2015 10:05:36 -0700 (PDT) Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim 4.80) (envelope-from ) id 1YWpUd-00029K-3L; Sat, 14 Mar 2015 17:04:55 +0000 Received: (nullmailer pid 4981 invoked by uid 1000); Sat, 14 Mar 2015 17:02:41 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [Patch v4 1/9] test: Add two tests for error output from notmuch_database_open Date: Sat, 14 Mar 2015 18:02:26 +0100 Message-Id: <1426352554-4383-2-git-send-email-david@tethera.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1426352554-4383-1-git-send-email-david@tethera.net> References: <1426352554-4383-1-git-send-email-david@tethera.net> 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, 14 Mar 2015 17:05:36 -0000 This is arguably testing the same thing twice, but in the brave new future where we don't use printf anymore, each subcommand will be responsible for handling the output on it's own. --- test/T050-new.sh | 7 +++++++ test/T150-tagging.sh | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/test/T050-new.sh b/test/T050-new.sh index 7119356..e6c3291 100755 --- a/test/T050-new.sh +++ b/test/T050-new.sh @@ -276,4 +276,11 @@ test_expect_code 1 "Invalid tags set exit code" \ notmuch config set new.tags $OLDCONFIG + +test_begin_subtest "Xapian exception: read only files" +chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.DB +output=$(NOTMUCH_NEW 2>&1 | sed 's/: .*$//' ) +chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.DB +test_expect_equal "$output" "A Xapian exception occurred opening database" + test_done diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh index 45471ac..4a2673d 100755 --- a/test/T150-tagging.sh +++ b/test/T150-tagging.sh @@ -261,4 +261,10 @@ test_expect_code 1 "Empty tag names" 'notmuch tag + One' test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One' +test_begin_subtest "Xapian exception: read only files" +chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.DB +output=$(notmuch tag +something '*' 2>&1 | sed 's/: .*$//' ) +chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.DB +test_expect_equal "$output" "A Xapian exception occurred opening database" + test_done -- 2.1.4