From baf93369f6a204bc16740358a56af95cbaa1f9b5 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sat, 14 Mar 2015 08:32:22 +0100 Subject: [PATCH] test: Add two tests for error output from notmuch_database_open 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 7119356f..e6c3291f 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 45471ac8..4a2673d4 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.43.0