2014-01-23 13:23:59 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
test_description='"notmuch show"'
|
|
|
|
|
2017-09-25 22:38:19 +02:00
|
|
|
. $(dirname "$0")/test-lib.sh || exit 1
|
2014-01-23 13:23:59 +01:00
|
|
|
|
2021-08-24 17:17:43 +02:00
|
|
|
test_query_syntax () {
|
|
|
|
test_begin_subtest "sexpr query: $1"
|
|
|
|
sexp=$(notmuch show --format=json --query=sexp "$1")
|
|
|
|
infix=$(notmuch show --format=json "$2")
|
|
|
|
test_expect_equal_json "$sexp" "$infix"
|
|
|
|
}
|
|
|
|
|
2014-01-23 13:23:59 +01:00
|
|
|
add_email_corpus
|
|
|
|
|
|
|
|
test_begin_subtest "exit code for show invalid query"
|
|
|
|
notmuch show foo..
|
|
|
|
exit_code=$?
|
|
|
|
test_expect_equal 1 $exit_code
|
|
|
|
|
2021-07-02 22:44:21 +02:00
|
|
|
test_begin_subtest "notmuch show --sort=newest-first"
|
|
|
|
notmuch show --entire-thread=true '*' > EXPECTED
|
|
|
|
notmuch show --entire-thread=true --sort=newest-first '*' > OUTPUT
|
|
|
|
test_expect_equal_file EXPECTED OUTPUT
|
|
|
|
|
|
|
|
test_begin_subtest "notmuch show --sort=oldest-first"
|
|
|
|
notmuch show --entire-thread=true '*' | grep ^depth:0 > EXPECTED
|
|
|
|
notmuch show --entire-thread=true --sort=oldest-first '*' | grep ^depth:0 > OLDEST
|
|
|
|
perl -e 'print reverse<>' OLDEST > OUTPUT
|
|
|
|
test_expect_equal_file EXPECTED OUTPUT
|
|
|
|
|
|
|
|
test_begin_subtest "notmuch show --sort for single thread"
|
|
|
|
QUERY="id:yun1vjwegii.fsf@aiko.keithp.com"
|
|
|
|
notmuch show --entire-thread=true --sort=newest-first $QUERY > EXPECTED
|
|
|
|
notmuch show --entire-thread=true --sort=oldest-first $QUERY > OUTPUT
|
|
|
|
test_expect_equal_file EXPECTED OUTPUT
|
|
|
|
|
2021-08-24 17:17:43 +02:00
|
|
|
|
|
|
|
if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
|
|
|
|
|
|
|
|
test_query_syntax '(and "wonderful" "wizard")' 'wonderful and wizard'
|
|
|
|
test_query_syntax '(or "php" "wizard")' 'php or wizard'
|
|
|
|
test_query_syntax 'wizard' 'wizard'
|
|
|
|
test_query_syntax 'Wizard' 'Wizard'
|
|
|
|
test_query_syntax '(attachment notmuch-help.patch)' 'attachment:notmuch-help.patch'
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2014-01-23 13:23:59 +01:00
|
|
|
test_done
|