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 E30E6431FDF for ; Fri, 27 Mar 2015 15:13:48 -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 CQmNWmvXBA4c for ; Fri, 27 Mar 2015 15:13:47 -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 A1A01429E2E for ; Fri, 27 Mar 2015 15:13:43 -0700 (PDT) Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim 4.80) (envelope-from ) id 1YbcUw-0000Ei-AX; Fri, 27 Mar 2015 22:13:02 +0000 Received: (nullmailer pid 1807 invoked by uid 1000); Fri, 27 Mar 2015 22:12:15 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [Patch v6 1/8] test: Add two tests for error output from notmuch_database_open Date: Fri, 27 Mar 2015 23:11:53 +0100 Message-Id: <1427494320-1483-2-git-send-email-david@tethera.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427494320-1483-1-git-send-email-david@tethera.net> References: <1427494320-1483-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: Fri, 27 Mar 2015 22:13:49 -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