unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 54c337ef7e8657c4ca4b7f4429f7009b94b8b34c 1340 bytes (raw)
name: test/T055-path-config.sh 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
 
#!/usr/bin/env bash
test_description='Configuration of mail-root and database path'
. $(dirname "$0")/test-lib.sh || exit 1

backup_config () {
    local test_name=$(basename $0 .sh)
    cp ${NOTMUCH_CONFIG} notmuch-config-backup.${test_name}
}

restore_config () {
    local test_name=$(basename $0 .sh)
    export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config"
    unset CONFIG_PATH
    unset DATABASE_PATH
    unset NOTMUCH_PROFILE
    cp notmuch-config-backup.${test_name} ${NOTMUCH_CONFIG}
}

split_config () {
    local dir
    backup_config
    dir="$TMP_DIRECTORY/database.$test_count"
    rm -rf $dir
    mkdir $dir
    notmuch config set database.path $dir
    notmuch config set database.mail_root $MAIL_DIR
    DATABASE_PATH=$dir
}

add_email_corpus

for config in traditional split+prefix; do
    backup_database

    case $config in
	traditional)
	    backup_config
	    ;;
	split+prefix)
	    split_config
	    mv mail/.notmuch $DATABASE_PATH
	    ;;
    esac

    test_begin_subtest "count ($config)"
    output=$(notmuch count '*')
    test_expect_equal "$output" '52'

    test_begin_subtest "count+tag ($config)"
    tag="tag${RANDOM}"
    notmuch tag +$tag '*'
    output=$(notmuch count tag:$tag)
    notmuch tag -$tag '*'
    test_expect_equal "$output" '52'

    restore_config
    restore_database
done

test_done

debug log:

solving 54c337ef ...
found 54c337ef in https://yhetil.org/notmuch/20210208004109.1192719-8-david@tethera.net/

applying [1/1] https://yhetil.org/notmuch/20210208004109.1192719-8-david@tethera.net/
diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh
new file mode 100755
index 00000000..54c337ef

Checking patch test/T055-path-config.sh...
Applied patch test/T055-path-config.sh cleanly.

index at:
100755 54c337ef7e8657c4ca4b7f4429f7009b94b8b34c	test/T055-path-config.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).