]> git.notmuchmail.org Git - notmuch/blob - test/T520-show.sh
CLI/show: tests for the new --sort option
[notmuch] / test / T520-show.sh
1 #!/usr/bin/env bash
2 test_description='"notmuch show"'
3
4 . $(dirname "$0")/test-lib.sh || exit 1
5
6 add_email_corpus
7
8 test_begin_subtest "exit code for show invalid query"
9 notmuch show foo..
10 exit_code=$?
11 test_expect_equal 1 $exit_code
12
13 test_begin_subtest "notmuch show --sort=newest-first"
14 notmuch show --entire-thread=true '*' > EXPECTED
15 notmuch show --entire-thread=true --sort=newest-first '*' > OUTPUT
16 test_expect_equal_file EXPECTED OUTPUT
17
18 test_begin_subtest "notmuch show --sort=oldest-first"
19 notmuch show --entire-thread=true '*' | grep ^depth:0 > EXPECTED
20 notmuch show --entire-thread=true --sort=oldest-first '*' | grep ^depth:0 > OLDEST
21 perl -e 'print reverse<>' OLDEST > OUTPUT
22 test_expect_equal_file EXPECTED OUTPUT
23
24 test_begin_subtest "notmuch show --sort for single thread"
25 QUERY="id:yun1vjwegii.fsf@aiko.keithp.com"
26 notmuch show --entire-thread=true --sort=newest-first $QUERY > EXPECTED
27 notmuch show --entire-thread=true --sort=oldest-first $QUERY > OUTPUT
28 test_expect_equal_file EXPECTED OUTPUT
29
30 test_done