2 test_description='"notmuch search" in several variations'
3 . $(dirname "$0")/test-lib.sh || exit 1
5 if [ $NOTMUCH_HAVE_SFSEXP -ne 1 ]; then
6 printf "Skipping due to missing sfsexp library\n"
12 test_begin_subtest "all messages: ()"
13 notmuch search '*' > EXPECTED
14 notmuch search --query=sexp "()" > OUTPUT
15 test_expect_equal_file EXPECTED OUTPUT
17 test_begin_subtest "single term in body"
18 notmuch search --query=sexp 'wizard' | notmuch_search_sanitize>OUTPUT
20 thread:XXX 2009-11-18 [1/3] Carl Worth| Jan Janak; [notmuch] What a great idea! (inbox unread)
22 test_expect_equal_file EXPECTED OUTPUT
24 test_begin_subtest "single term in body (case insensitive)"
25 notmuch search --query=sexp 'Wizard' | notmuch_search_sanitize>OUTPUT
27 thread:XXX 2009-11-18 [1/3] Carl Worth| Jan Janak; [notmuch] What a great idea! (inbox unread)
29 test_expect_equal_file EXPECTED OUTPUT
31 test_begin_subtest "single term in body, stemmed version"
32 test_subtest_known_broken
33 notmuch search arriv > EXPECTED
34 notmuch search --query=sexp arriv > OUTPUT
35 test_expect_equal_file EXPECTED OUTPUT
37 test_begin_subtest "Unbalanced parens"
38 # A code 1 indicates the error was handled (a crash will return e.g. 139).
39 test_expect_code 1 "notmuch search --query=sexp '('"
41 test_begin_subtest "Unbalanced parens, error message"
42 notmuch search --query=sexp '(' >OUTPUT 2>&1
44 notmuch search: Syntax error in query
45 invalid s-expression: '('
47 test_expect_equal_file EXPECTED OUTPUT
49 test_begin_subtest "unknown prefix"
50 notmuch search --query=sexp '(foo)' >OUTPUT 2>&1
52 notmuch search: Syntax error in query
55 test_expect_equal_file EXPECTED OUTPUT
57 test_begin_subtest "list as prefix"
58 notmuch search --query=sexp '((foo))' >OUTPUT 2>&1
60 notmuch search: Syntax error in query
61 unexpected list in field/operation position
63 test_expect_equal_file EXPECTED OUTPUT