]> git.notmuchmail.org Git - notmuch/blob - test/T040-setup.sh
test/setup: check file output instead of notmuch config list
[notmuch] / test / T040-setup.sh
1 #!/usr/bin/env bash
2
3 test_description='"notmuch setup"'
4 . $(dirname "$0")/test-lib.sh || exit 1
5
6 test_begin_subtest "Notmuch new without a config suggests notmuch setup"
7 output=$(notmuch --config=new-notmuch-config new 2>&1)
8 test_expect_equal "$output" "\
9 Error: cannot load config file.
10 Try running 'notmuch setup' to create a configuration."
11
12 test_begin_subtest "Create a new config interactively"
13 notmuch --config=new-notmuch-config > log.${test_count} <<EOF
14 Test Suite
15 test.suite@example.com
16 another.suite@example.com
17
18 /path/to/maildir
19 foo bar
20 baz
21 EOF
22
23 expected_dir=$NOTMUCH_SRCDIR/test/setup.expected-output
24 test_expect_equal_file ${expected_dir}/config-with-comments new-notmuch-config
25
26 test_begin_subtest "notmuch with a config but without a database suggests notmuch new"
27 notmuch 2>&1 | notmuch_dir_sanitize > OUTPUT
28 cat <<EOF > EXPECTED
29 Notmuch is configured, but there's not yet a database at
30
31         MAIL_DIR/.notmuch
32
33 You probably want to run "notmuch new" now to create that database.
34
35 Note that the first run of "notmuch new" can take a very long time
36 and that the resulting database will use roughly the same amount of
37 storage space as the email being indexed.
38
39 EOF
40 test_expect_equal_file EXPECTED OUTPUT
41
42 test_done