test/search: add known broken tests for 'date' prefix

This is documented, but apparently not implemented. Add tests for
planned supported syntax and error messages.
This commit is contained in:
David Bremner 2022-01-20 09:36:00 -04:00
parent da302e1cba
commit e02bf15a4f

View file

@ -768,6 +768,78 @@ notmuch search date:2009-11-18..2009-11-18 and tag:unread > EXPECTED
notmuch search --query=sexp '(and (infix "date:2009-11-18..2009-11-18") (infix "tag:unread"))' > OUTPUT
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "date query, empty"
test_subtest_known_broken
notmuch search from:keithp | notmuch_search_sanitize > EXPECTED
notmuch search --query=sexp '(and (date) (from keithp))'| notmuch_search_sanitize > OUTPUT
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "date query, one argument"
test_subtest_known_broken
notmuch search date:2009-11-18 and from:keithp | notmuch_search_sanitize > EXPECTED
notmuch search --query=sexp '(and (date 2009-11-18) (from keithp))' | notmuch_search_sanitize > OUTPUT
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "date query, two arguments"
test_subtest_known_broken
notmuch search date:2009-11-17..2009-11-18 and from:keithp | notmuch_search_sanitize > EXPECTED
notmuch search --query=sexp '(and (date 2009-11-17 2009-11-18) (from keithp))' | notmuch_search_sanitize > OUTPUT
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "date query, illegal nesting 1"
test_subtest_known_broken
notmuch search --query=sexp '(to (date))' > OUTPUT 2>&1
cat <<EOF > EXPECTED
notmuch search: Syntax error in query
nested field: 'date' inside 'to'
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "date query, illegal nesting 2"
test_subtest_known_broken
notmuch search --query=sexp '(to (date 2021-11-18))' > OUTPUT 2>&1
cat <<EOF > EXPECTED
notmuch search: Syntax error in query
nested field: 'date' inside 'to'
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "date query, illegal nesting 3"
test_subtest_known_broken
notmuch search --query=sexp '(date (to))' > OUTPUT 2>&1
cat <<EOF > EXPECTED
notmuch search: Syntax error in query
expected atom as first argument of 'date'
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "date query, illegal nesting 4"
test_subtest_known_broken
notmuch search --query=sexp '(date today (to))' > OUTPUT 2>&1
cat <<EOF > EXPECTED
notmuch search: Syntax error in query
expected atom as second argument of 'date'
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "date query, too many arguments"
test_subtest_known_broken
notmuch search --query=sexp '(date yesterday and tommorow)' > OUTPUT 2>&1
cat <<EOF > EXPECTED
notmuch search: Syntax error in query
'date' expects maximum of two arguments
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "date query, bad date"
test_subtest_known_broken
notmuch search --query=sexp '(date "hawaiian-pizza-day")' > OUTPUT 2>&1
cat <<EOF > EXPECTED
notmuch search: Syntax error in query
Didn't understand date specification 'hawaiian-pizza-day'
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "user header (unknown header)"
notmuch search --query=sexp '(FooBar)' >& OUTPUT
cat <<EOF > EXPECTED