mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
lib/sexp: allow * as alias for "" in range searches.
It can be tedious to use "" inside of a string, e.g. in a shell script.
This commit is contained in:
parent
7863234586
commit
e7ffb74041
2 changed files with 25 additions and 0 deletions
|
@ -473,6 +473,9 @@ _sexp_parse_range (notmuch_database_t *notmuch, const _sexp_prefix_t *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
from = sx->val;
|
from = sx->val;
|
||||||
|
if (strcmp (from, "*") == 0)
|
||||||
|
from = "";
|
||||||
|
|
||||||
to = from;
|
to = from;
|
||||||
|
|
||||||
if (sx->next) {
|
if (sx->next) {
|
||||||
|
@ -488,6 +491,8 @@ _sexp_parse_range (notmuch_database_t *notmuch, const _sexp_prefix_t *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
to = sx->next->val;
|
to = sx->next->val;
|
||||||
|
if (strcmp (to, "*") == 0)
|
||||||
|
to = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp (prefix->name, "date") == 0) {
|
if (strcmp (prefix->name, "date") == 0) {
|
||||||
|
|
|
@ -864,6 +864,16 @@ notmuch search date:..2009-11-17 and from:keithp | notmuch_search_sanitize > EXP
|
||||||
notmuch search --query=sexp '(and (date "" 2009-11-17) (from keithp))' | notmuch_search_sanitize > OUTPUT
|
notmuch search --query=sexp '(and (date "" 2009-11-17) (from keithp))' | notmuch_search_sanitize > OUTPUT
|
||||||
test_expect_equal_file_nonempty EXPECTED OUTPUT
|
test_expect_equal_file_nonempty EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "date query, lower bound only, using *"
|
||||||
|
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, using *"
|
||||||
|
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"
|
test_begin_subtest "date query, illegal nesting 1"
|
||||||
notmuch search --query=sexp '(to (date))' > OUTPUT 2>&1
|
notmuch search --query=sexp '(to (date))' > OUTPUT 2>&1
|
||||||
cat <<EOF > EXPECTED
|
cat <<EOF > EXPECTED
|
||||||
|
@ -941,6 +951,16 @@ notmuch search lastmod:..$revision2 | notmuch_search_sanitize > EXPECTED
|
||||||
notmuch search --query=sexp "(lastmod \"\" $revision2)" | notmuch_search_sanitize > OUTPUT
|
notmuch search --query=sexp "(lastmod \"\" $revision2)" | notmuch_search_sanitize > OUTPUT
|
||||||
test_expect_equal_file_nonempty EXPECTED OUTPUT
|
test_expect_equal_file_nonempty EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "lastmod query, lower bound only, using *"
|
||||||
|
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, using *"
|
||||||
|
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"
|
test_begin_subtest "lastmod query, illegal nesting 1"
|
||||||
notmuch search --query=sexp '(to (lastmod))' > OUTPUT 2>&1
|
notmuch search --query=sexp '(to (lastmod))' > OUTPUT 2>&1
|
||||||
cat <<EOF > EXPECTED
|
cat <<EOF > EXPECTED
|
||||||
|
|
Loading…
Reference in a new issue