]> git.cworth.org Git - notmuch/commitdiff
test: Add two tests for error output from notmuch_database_open
authorDavid Bremner <david@tethera.net>
Sat, 14 Mar 2015 07:32:22 +0000 (08:32 +0100)
committerDavid Bremner <david@tethera.net>
Sun, 15 Mar 2015 19:27:20 +0000 (20:27 +0100)
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
test/T150-tagging.sh

index 7119356fc9fe1dc20d6a8d5f4be20f5117bb816a..e6c3291f786553c972e457cf5aeb749c1edca5e5 100755 (executable)
@@ -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
index 45471ac8de72962937761873c81b1f6bcb229609..4a2673d442b17379f8d18f4950f325a5247c7ea9 100755 (executable)
@@ -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