2 test_description='"notmuch show"'
4 . $(dirname "$0")/test-lib.sh || exit 1
7 test_begin_subtest "sexpr query: $1"
8 sexp=$(notmuch show --format=json --query=sexp "$1")
9 infix=$(notmuch show --format=json "$2")
10 test_expect_equal_json "$sexp" "$infix"
15 test_begin_subtest "exit code for show invalid query"
18 test_expect_equal 1 $exit_code
20 test_begin_subtest "notmuch show --sort=newest-first"
21 notmuch show --entire-thread=true '*' > EXPECTED
22 notmuch show --entire-thread=true --sort=newest-first '*' > OUTPUT
23 test_expect_equal_file EXPECTED OUTPUT
25 test_begin_subtest "notmuch show --sort=oldest-first"
26 notmuch show --entire-thread=true '*' | grep ^depth:0 > EXPECTED
27 notmuch show --entire-thread=true --sort=oldest-first '*' | grep ^depth:0 > OLDEST
28 perl -e 'print reverse<>' OLDEST > OUTPUT
29 test_expect_equal_file EXPECTED OUTPUT
31 test_begin_subtest "notmuch show --sort for single thread"
32 QUERY="id:yun1vjwegii.fsf@aiko.keithp.com"
33 notmuch show --entire-thread=true --sort=newest-first $QUERY > EXPECTED
34 notmuch show --entire-thread=true --sort=oldest-first $QUERY > OUTPUT
35 test_expect_equal_file EXPECTED OUTPUT
38 if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
40 test_query_syntax '(and "wonderful" "wizard")' 'wonderful and wizard'
41 test_query_syntax '(or "php" "wizard")' 'php or wizard'
42 test_query_syntax 'wizard' 'wizard'
43 test_query_syntax 'Wizard' 'Wizard'
44 test_query_syntax '(attachment notmuch-help.patch)' 'attachment:notmuch-help.patch'