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 notmuch search arriv > EXPECTED
33 notmuch search --query=sexp arriv > OUTPUT
34 test_expect_equal_file EXPECTED OUTPUT
36 test_begin_subtest "single term in body, unstemmed version"
37 notmuch search --query=sexp '"arriv"' > OUTPUT
38 test_expect_equal_file /dev/null OUTPUT
40 test_begin_subtest "Unbalanced parens"
41 # A code 1 indicates the error was handled (a crash will return e.g. 139).
42 test_expect_code 1 "notmuch search --query=sexp '('"
44 test_begin_subtest "Unbalanced parens, error message"
45 notmuch search --query=sexp '(' >OUTPUT 2>&1
47 notmuch search: Syntax error in query
48 invalid s-expression: '('
50 test_expect_equal_file EXPECTED OUTPUT
52 test_begin_subtest "unknown prefix"
53 notmuch search --query=sexp '(foo)' >OUTPUT 2>&1
55 notmuch search: Syntax error in query
58 test_expect_equal_file EXPECTED OUTPUT
60 test_begin_subtest "list as prefix"
61 notmuch search --query=sexp '((foo))' >OUTPUT 2>&1
63 notmuch search: Syntax error in query
64 unexpected list in field/operation position
66 test_expect_equal_file EXPECTED OUTPUT