test/sexp: one sided range searches.

The date range parsing machinery already knows how to do something
appropriate with an empty string, but the lastmod parsing blindly
tries to parse each atom as a number.
This commit is contained in:
David Bremner 2022-06-04 18:53:56 -03:00
parent 6f749dd24a
commit 254912821f

View file

@ -854,6 +854,16 @@ notmuch search date:2009-11-17..2009-11-18 and from:keithp | notmuch_search_sani
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, lower bound only"
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_nonempty EXPECTED OUTPUT
test_begin_subtest "date query, upper bound only"
notmuch search date:..2009-11-17 and from:keithp | notmuch_search_sanitize > EXPECTED
notmuch search --query=sexp '(and (date "" 2009-11-17) (from keithp))' | notmuch_search_sanitize > OUTPUT
test_expect_equal_file_nonempty EXPECTED OUTPUT
test_begin_subtest "date query, illegal nesting 1"
notmuch search --query=sexp '(to (date))' > OUTPUT 2>&1
cat <<EOF > EXPECTED
@ -921,6 +931,18 @@ notmuch search lastmod:$revision..$revision2 | notmuch_search_sanitize > EXPECTE
notmuch search --query=sexp "(and (lastmod $revision $revision2))" | notmuch_search_sanitize > OUTPUT
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "lastmod query, lower bound only"
test_subtest_known_broken
notmuch search lastmod:$revision.. | notmuch_search_sanitize > EXPECTED
notmuch search --query=sexp "(lastmod $revision \"\")" | notmuch_search_sanitize > OUTPUT
test_expect_equal_file_nonempty EXPECTED OUTPUT
test_begin_subtest "lastmod query, upper bound only"
test_subtest_known_broken
notmuch search lastmod:..$revision2 | notmuch_search_sanitize > EXPECTED
notmuch search --query=sexp "(lastmod \"\" $revision2)" | notmuch_search_sanitize > OUTPUT
test_expect_equal_file_nonempty EXPECTED OUTPUT
test_begin_subtest "lastmod query, illegal nesting 1"
notmuch search --query=sexp '(to (lastmod))' > OUTPUT 2>&1
cat <<EOF > EXPECTED