3 # Copyright (c) 2018 David Bremner
6 test_description='test of searching by using thread subqueries'
8 . $(dirname "$0")/test-lib.sh || exit 1
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"
16 test_begin_subtest "Same query against threads"
17 notmuch search thread:{from:keithp} and thread:{to:keithp} | notmuch_search_sanitize > OUTPUT
19 thread:XXX 2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread)
21 test_expect_equal_file EXPECTED OUTPUT
23 test_begin_subtest "Mix thread and non-threads query"
24 notmuch search thread:{from:keithp} and to:keithp | notmuch_search_sanitize > OUTPUT
26 thread:XXX 2009-11-18 [1/7] Lars Kellogg-Stedman| Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread)
28 test_expect_equal_file EXPECTED OUTPUT
30 test_begin_subtest "Compound subquery"
31 notmuch search 'thread:"{from:keithp and date:2009}" and thread:{to:keithp}' | notmuch_search_sanitize > OUTPUT
33 thread:XXX 2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread)
35 test_expect_equal_file EXPECTED OUTPUT
37 test_begin_subtest "Syntax/quoting error in subquery"
38 notmuch search 'thread:{from:keithp and date:2009} and thread:{to:keithp}' 1>OUTPUT 2>&1
40 notmuch search: A Xapian exception occurred
41 A Xapian exception occurred parsing query: missing } in '{from:keithp'
42 Query string was: thread:{from:keithp and date:2009} and thread:{to:keithp}
44 test_expect_equal_file EXPECTED OUTPUT