mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 09:24:54 +01:00
test/sexp: add known broken tests for macro param inside rx/wildcard
These tests replicate the problem reported by Eric Colson [1] (for the regex case). [1]: id:87o7yxqxy6.fsf@code.pm
This commit is contained in:
parent
2a5e1cf98b
commit
4464a5d073
1 changed files with 50 additions and 0 deletions
|
@ -1155,6 +1155,26 @@ too many arguments to macro
|
|||
EOF
|
||||
test_expect_equal_file EXPECTED OUTPUT
|
||||
|
||||
test_begin_subtest "Saved Search: bad parameter syntax 5"
|
||||
test_subtest_known_broken
|
||||
notmuch config set squery.Bad5 '(macro (thing) (tag (rx ,thing)))'
|
||||
notmuch search --query=sexp '(Bad5 (1 2))' >OUTPUT 2>&1
|
||||
cat <<EOF > EXPECTED
|
||||
notmuch search: Syntax error in query
|
||||
'rx' expects single atom as argument
|
||||
EOF
|
||||
test_expect_equal_file EXPECTED OUTPUT
|
||||
|
||||
test_begin_subtest "Saved Search: bad parameter syntax 6"
|
||||
test_subtest_known_broken
|
||||
notmuch config set squery.Bad6 '(macro (thing) (tag (starts-with ,thing)))'
|
||||
notmuch search --query=sexp '(Bad6 (1 2))' >OUTPUT 2>&1
|
||||
cat <<EOF > EXPECTED
|
||||
notmuch search: Syntax error in query
|
||||
'starts-with' expects single atom as argument
|
||||
EOF
|
||||
test_expect_equal_file EXPECTED OUTPUT
|
||||
|
||||
test_begin_subtest "Saved Search: macro without body"
|
||||
notmuch config set squery.Bad3 '(macro (a b))'
|
||||
notmuch search --query=sexp '(Bad3)' >OUTPUT 2>&1
|
||||
|
@ -1206,6 +1226,20 @@ notmuch config set squery.TagSubject2 '(macro (tagname subj) (and (tag ,tagname
|
|||
notmuch search --query=sexp '(TagSubject2 inbox maildir)' | notmuch_search_sanitize > OUTPUT
|
||||
test_expect_equal_file EXPECTED OUTPUT
|
||||
|
||||
test_begin_subtest "macro in regex"
|
||||
test_subtest_known_broken
|
||||
notmuch search tag:inbox and date:2009-11-17 | notmuch_search_sanitize > EXPECTED
|
||||
notmuch config set squery.D '(macro (tagname) (and (date 2009-11-17) (tag (rx ,tagname))))'
|
||||
notmuch search --query=sexp '(D inbo)' | notmuch_search_sanitize > OUTPUT
|
||||
test_expect_equal_file_nonempty EXPECTED OUTPUT
|
||||
|
||||
test_begin_subtest "macro in wildcard"
|
||||
test_subtest_known_broken
|
||||
notmuch search tag:inbox and date:2009-11-17 | notmuch_search_sanitize > EXPECTED
|
||||
notmuch config set squery.W '(macro (tagname) (and (date 2009-11-17) (tag (starts-with ,tagname))))'
|
||||
notmuch search --query=sexp '(W inbo)' | notmuch_search_sanitize > OUTPUT
|
||||
test_expect_equal_file_nonempty EXPECTED OUTPUT
|
||||
|
||||
test_begin_subtest "nested macros (shadowing)"
|
||||
notmuch search tag:inbox and subject:maildir | notmuch_search_sanitize > EXPECTED
|
||||
notmuch config set squery.Inner '(macro (x) (subject ,x))'
|
||||
|
@ -1223,6 +1257,22 @@ undefined parameter y
|
|||
EOF
|
||||
test_expect_equal_file EXPECTED OUTPUT
|
||||
|
||||
test_begin_subtest "nested macros (shadowing, regex)"
|
||||
test_subtest_known_broken
|
||||
notmuch search tag:/inbo/ and subject:/Maildi/ | notmuch_search_sanitize > EXPECTED
|
||||
notmuch config set squery.Inner3 '(macro (x) (subject (rx ,x)))'
|
||||
notmuch config set squery.Outer3 '(macro (x y) (and (tag (rx ,x)) (Inner3 ,y)))'
|
||||
notmuch search --query=sexp '(Outer3 inbo Maildi)' | notmuch_search_sanitize > OUTPUT
|
||||
test_expect_equal_file_nonempty EXPECTED OUTPUT
|
||||
|
||||
test_begin_subtest "nested macros (shadowing, wildcard)"
|
||||
test_subtest_known_broken
|
||||
notmuch search tag:inbox and subject:maildir | notmuch_search_sanitize > EXPECTED
|
||||
notmuch config set squery.Inner4 '(macro (x) (subject (starts-with ,x)))'
|
||||
notmuch config set squery.Outer4 '(macro (x y) (and (tag (starts-with ,x)) (Inner4 ,y)))'
|
||||
notmuch search --query=sexp '(Outer4 inbo maildi)' | notmuch_search_sanitize > OUTPUT
|
||||
test_expect_equal_file_nonempty EXPECTED OUTPUT
|
||||
|
||||
test_begin_subtest "combine macro and user defined header"
|
||||
notmuch config set squery.About '(macro (name) (or (subject ,name) (List ,name)))'
|
||||
notmuch search subject:notmuch or List:notmuch | notmuch_search_sanitize > EXPECTED
|
||||
|
|
Loading…
Reference in a new issue