unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob b6d778a2ab32d0acff2e87fda5998699ee4000b6 1518 bytes (raw)
name: test/T051-new-linking.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
 
#!/usr/bin/env bash
test_description='"notmuch new" thread linking'

. ./test-lib.sh

test_begin_subtest "All four-message threads get linked in all delivery orders"
# Generate all possible single-root four message thread structures.
# Each line in THREADS is a thread structure, where the n'th field is
# the parent of message n.
THREADS=$(python -c '
def mkTrees(free, tree={}):
    if not free:
        print(" ".join(map(str, [msg[1] for msg in sorted(tree.items())])))
        return
    # Attach each free message to each message in the tree (if there is
    # no tree, make the free message the root)
    for msg in sorted(free):
        parents = sorted(tree.keys()) if tree else ["none"]
        for parent in parents:
            ntree = tree.copy()
            ntree[msg] = parent
            mkTrees(free - set([msg]), ntree)
mkTrees(set(range(4)))')
for ((n = 0; n < 4; n++)); do
    # Deliver the n'th message of every thread
    thread=0
    while read -a parents; do
        parent=${parents[$n]}
        generate_message \
            [id]=m$n@t$thread [in-reply-to]="\<m$parent@t$thread\>" \
            [subject]=p$thread [from]=m$n
        thread=$((thread + 1))
    done <<< "$THREADS"
    notmuch new > /dev/null
done
output=$(notmuch search '*' | notmuch_search_sanitize)
nthreads=$(wc -l <<< "$THREADS")
expected=$(for ((i = 0; i < $nthreads; i++)); do
        echo "thread:XXX   2001-01-05 [4/4] m3, m2, m1, m0; p$i (inbox unread)"
    done)
test_expect_equal "$output" "$expected"

test_done

debug log:

solving b6d778a ...
found b6d778a in https://yhetil.org/notmuch/1395608456-9673-1-git-send-email-amdragon@mit.edu/

applying [1/1] https://yhetil.org/notmuch/1395608456-9673-1-git-send-email-amdragon@mit.edu/
diff --git a/test/T051-new-linking.sh b/test/T051-new-linking.sh
new file mode 100755
index 0000000..b6d778a

Checking patch test/T051-new-linking.sh...
Applied patch test/T051-new-linking.sh cleanly.

index at:
100755 b6d778a2ab32d0acff2e87fda5998699ee4000b6	test/T051-new-linking.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).