]> git.cworth.org Git - notmuch/blob - test/T585-thread-subquery.sh
doc: don't build notmuch-emacs.info for configure --without-emacs
[notmuch] / test / T585-thread-subquery.sh
1 #!/usr/bin/env bash
2 #
3 # Copyright (c) 2018 David Bremner
4 #
5
6 test_description='test of searching by using thread subqueries'
7
8 . $(dirname "$0")/test-lib.sh || exit 1
9
10 add_email_corpus
11
12 test_begin_subtest "Basic query that matches no messages"
13 count=$(notmuch count from:keithp and to:keithp)
14 test_expect_equal 0 "$count"
15
16 test_begin_subtest "Same query against threads"
17 if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 0 ]; then
18     test_subtest_known_broken
19 fi
20 notmuch search thread:{from:keithp} and thread:{to:keithp} | notmuch_search_sanitize > OUTPUT
21 cat<<EOF > EXPECTED
22 thread:XXX   2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread)
23 EOF
24 test_expect_equal_file EXPECTED OUTPUT
25
26 test_begin_subtest "Mix thread and non-threads query"
27 if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 0 ]; then
28     test_subtest_known_broken
29 fi
30 notmuch search thread:{from:keithp} and to:keithp | notmuch_search_sanitize > OUTPUT
31 cat<<EOF > EXPECTED
32 thread:XXX   2009-11-18 [1/7] Lars Kellogg-Stedman| Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread)
33 EOF
34 test_expect_equal_file EXPECTED OUTPUT
35
36 test_begin_subtest "Compound subquery"
37 if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 0 ]; then
38     test_subtest_known_broken
39 fi
40 notmuch search 'thread:"{from:keithp and date:2009}" and thread:{to:keithp}' | notmuch_search_sanitize > OUTPUT
41 cat<<EOF > EXPECTED
42 thread:XXX   2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread)
43 EOF
44 test_expect_equal_file EXPECTED OUTPUT
45
46 test_begin_subtest "Syntax/quoting error in subquery"
47 if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 0 ]; then
48     test_subtest_known_broken
49 fi
50 notmuch search 'thread:{from:keithp and date:2009} and thread:{to:keithp}' 1>OUTPUT 2>&1
51 cat<<EOF > EXPECTED
52 notmuch search: A Xapian exception occurred
53 A Xapian exception occurred parsing query: missing } in '{from:keithp'
54 Query string was: thread:{from:keithp and date:2009} and thread:{to:keithp}
55 EOF
56 test_expect_equal_file EXPECTED OUTPUT
57
58 test_done