#!/usr/bin/env bash test_description='Configuration of mail-root and database path' . $(dirname "$0")/test-lib.sh || exit 1 add_email_corpus test_begin_subtest "database is mail/.notmuch/xapian" output=$(notmuch count '*') test_expect_equal $output '52' backup_database test_begin_subtest "split (with prefix)" notmuch config set database.path `pwd`/database notmuch config set database.mail_root `pwd`/mail mkdir database mv mail/.notmuch database output=$(notmuch count '*') test_expect_equal "$output" '52' restore_database backup_database test_begin_subtest "split (read-write)" notmuch config set database.path `pwd`/database notmuch config set database.mail_root `pwd`/mail mkdir database mv mail/.notmuch database tag="tag${RANDOM}" notmuch tag +$tag '*' output=$(notmuch count tag:$tag) test_expect_equal "$output" '52' restore_database backup_database test_begin_subtest "create database in split configuration" notmuch config set database.path `pwd`/database notmuch config set database.mail_root `pwd`/mail rm -r mail/.notmuch/xapian notmuch new output=$(notmuch count '*') test_expect_equal "$output" '52' restore_database backup_database test_begin_subtest "split (no prefix)" notmuch config set database.path `pwd`/database notmuch config set database.mail_root `pwd`/mail mv mail/.notmuch/xapian database output=$(notmuch count '*') test_expect_equal "$output" '52' restore_database backup_database test_begin_subtest "xdg database location" notmuch config set database.mail_root `pwd`/mail notmuch config set database.path dir=home/.local/share/notmuch/default/ mkdir -p $dir mv mail/.notmuch/xapian $dir output=$(notmuch count '*') test_expect_equal "$output" '52' restore_database test_done