X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2FT150-tagging.sh;h=a451ffaeb39e3db7529332564b214c8d00f90b8a;hb=92e59568fa4eec466db78af6c21c39ca5826b0d7;hp=dc118f331ff054ac53476a7221e1d9f42a35d987;hpb=28d7544ae2adfe6467c6b64a3284f5ed13f81e1a;p=notmuch diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh index dc118f33..a451ffae 100755 --- a/test/T150-tagging.sh +++ b/test/T150-tagging.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash test_description='"notmuch tag"' -. ./test-lib.sh +. ./test-lib.sh || exit 1 add_message '[subject]=One' add_message '[subject]=Two' @@ -38,6 +38,17 @@ test_expect_equal "$output" "\ thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One () thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (tag5 tag6 unread)" +test_begin_subtest "Remove all with batch" +notmuch tag +tag1 One +notmuch tag --remove-all --batch < OUTPUT notmuch restore --format=batch-tag < backup.tags test_expect_equal_file batch.expected OUTPUT +test_begin_subtest "--batch --input --remove-all" +notmuch dump --format=batch-tag > backup.tags +notmuch tag +foo +bar -- One +notmuch tag +tag7 -- Two +notmuch tag --batch --input=batch.in --remove-all +notmuch search \* | notmuch_search_sanitize > OUTPUT +notmuch restore --format=batch-tag < backup.tags +cat > batch_removeall.expected < EXPECTED notmuch tag --batch < EXPECTED -notmuch dump --format=batch-tag | sed 's/^.* -- / -- /' | \ - notmuch restore --format=batch-tag +notmuch dump --format=batch-tag | sed 's/^.* -- / -- /' > INTERMEDIATE_STEP +notmuch restore --format=batch-tag < INTERMEDIATE_STEP notmuch tag --batch < EXPECTED @@ -261,4 +286,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_ending} +output=$(notmuch tag +something '*' 2>&1 | sed 's/: .*$//' ) +chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.${db_ending} +test_expect_equal "$output" "A Xapian exception occurred opening database" + test_done