[PATCH] test: Test thread linking in all possible delivery orders
David Bremner
david at tethera.net
Mon Apr 7 03:37:48 PDT 2014
Austin Clements <amdragon at MIT.EDU> writes:
> +THREADS=$(python -c '
> +def mkTrees(free, tree={}):
> + if not free:
I'm not sure if using not for an empty set is idiomatic python or not,
but it did confuse me a moment.
> + 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)))')
FWIW, it took me a while to understand this. I might have twigged
faster if the initial comment said something like "via backtracking".
> +output=$(notmuch search '*' | notmuch_search_sanitize)
> +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"
It seems to me this summary line depends on the default search order.
It might be worth specifying the search order in the "notmuch search"
command just to make it a bit more robust.
d
More information about the notmuch
mailing list