Should have come before commit 1df71b55 --- test/config | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++ test/notmuch-test | 1 + 2 files changed, 89 insertions(+), 0 deletions(-) create mode 100755 test/config
diff --git a/test/config b/test/config new file mode 100755 index 0000000..ee3126c --- /dev/null +++ b/test/config @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +test_description='notmuch config' +. ./test-lib.sh + + +config_options=( + "database.path" + "user.name" + "user.primary_email" + "user.other_email" + "new.tags" + "maildir.synchronize_flags" +) + + +test_begin_subtest 'getting config: "config get <section>.<item>"' +echo -n "" > OUTPUT +for i in ${config_options[*]} ; do + notmuch config get "${i}" +done >> OUTPUT +cat >EXPECTED <<EOF +${MAIL_DIR} +Notmuch Test Suite +test_su...@notmuchmail.org +test_suite_ot...@notmuchmail.org +test_su...@otherdomain.org +unread +inbox +true +EOF +test_expect_equal_file OUTPUT EXPECTED + + +test_begin_subtest 'setting config: "config set <section>.<item> [values ...]"' +notmuch config set database.path /path/to/maildir +notmuch config set user.name "User Name" +notmuch config set user.primary_email primary_em...@notmuchmail.org +notmuch config set user.other_email a...@notmuchmail.org a...@notmuchmail.org +notmuch config set new.tags tag1 tag2 tag3 +notmuch config set maildir.synchronize_flags false +echo -n "" > OUTPUT +for i in ${config_options[*]} ; do + notmuch config get "${i}" +done >> OUTPUT +cat >EXPECTED <<EOF +/path/to/maildir +User Name +primary_em...@notmuchmail.org +a...@notmuchmail.org +a...@notmuchmail.org +tag1 +tag2 +tag3 +false +EOF +test_expect_equal_file OUTPUT EXPECTED + + +test_begin_subtest 'removing config: "config set <section>.<item>"' +notmuch config set database.path +notmuch config set user.name +notmuch config set user.primary_email +notmuch config set user.other_email +notmuch config set new.tags +notmuch config set maildir.synchronize_flags +echo -n "" > OUTPUT +for i in ${config_options[*]} ; do + notmuch config get "${i}" +done >> OUTPUT + +# FIXME: Not the most robust nor portable solution here... +# Especially `hostname --domain' may have unwanted effects on +# some platforms, e.g. setting your hostname to "--domain" ;) +fallback_name="$(grep $(id -un) /etc/passwd | cut -d ":" -f 5 | cut -d "," -f 1)" +fallback_email="$(id -un)@$(hostname).$(hostname --domain)" + +cat >EXPECTED <<EOF +${HOME}/mail +${fallback_name} +${fallback_email} +unread +inbox +true +EOF +test_expect_equal_file OUTPUT EXPECTED + + +test_done diff --git a/test/notmuch-test b/test/notmuch-test index e40ef86..f0c1d7c 100755 --- a/test/notmuch-test +++ b/test/notmuch-test @@ -18,6 +18,7 @@ cd $(dirname "$0") TESTS=" basic + config help-test new count -- 1.7.8.1 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch