]> git.notmuchmail.org Git - notmuch/commitdiff
CLI/show: tests for the new --sort option
authorjao <jao@gnu.org>
Fri, 2 Jul 2021 20:44:21 +0000 (21:44 +0100)
committerDavid Bremner <david@tethera.net>
Sat, 3 Jul 2021 23:27:39 +0000 (20:27 -0300)
New unit tests for notmuch show --sort, covering the basic use cases.

test/T520-show.sh

index 16222650eafc68b1d1f816a8cdda96bc3b0ce23a..6f42ca12debaf795ab04f28aa80b97fc70ba6489 100755 (executable)
@@ -10,4 +10,21 @@ notmuch show foo..
 exit_code=$?
 test_expect_equal 1 $exit_code
 
+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
+
 test_done