#!/usr/bin/env bash
test_description='"notmuch search" in several variations'
-. ./test-lib.sh || exit 1
+. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus
output=$(notmuch search 'to:"Search By To Name"' | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)"
-test_begin_subtest "Search by to: (name and adress)"
+test_begin_subtest "Search by to: (name and address)"
output=$(notmuch search 'to:"Search By To Name <test@example.com>"' | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)"
-test_begin_subtest "Search by to: without prefix (name and adress)"
+test_begin_subtest "Search by to: without prefix (name and address)"
output=$(notmuch search '"Search By To Name <test@example.com>"' | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)"
output=$(notmuch search id:termpos and '"c x"')
test_expect_equal "$output" ""
+if [[ NOTMUCH_HAVE_SFSEXP = 1 ]]; then
+ test_begin_subtest "sexpr query: all messages"
+ notmuch search '*' > EXPECTED
+ notmuch search --query=sexp '()' > OUTPUT
+ test_expect_equal_file EXPECTED OUTPUT
+fi
+
test_done