[PATCH Draft 2 9/9] test: add tests for restore --auto

David Bremner david at tethera.net
Sun Dec 18 05:15:11 PST 2011


From: David Bremner <bremner at debian.org>

We start by restoring the original tags, and making sure that restore
worked. Next we test each possible input to autodetection, both
explicit (with --format=auto) and implicit (without --format).
---
 test/dump-restore |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/test/dump-restore b/test/dump-restore
index ef4a63e..8400c7b 100755
--- a/test/dump-restore
+++ b/test/dump-restore
@@ -119,7 +119,6 @@ test_begin_subtest 'format=notmuch, round trip with strange tags'
     notmuch dump --format=notmuch > OUTPUT.$test_count
 test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 
-
 test_begin_subtest 'format=notmuch, checking encoded output'
     cp /dev/null EXPECTED.$test_count
     notmuch dump --format=notmuch -- from:cworth |\
@@ -128,6 +127,37 @@ test_begin_subtest 'format=notmuch, checking encoded output'
     notmuch dump --format=notmuch -- from:cworth  > OUTPUT.$test_count
 test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 
-notmuch restore --format=notmuch < BACKUP
+test_begin_subtest 'restoring sane tags'
+    notmuch restore --format=notmuch < BACKUP
+    notmuch dump --format=notmuch > OUTPUT.$test_count
+test_expect_equal_file BACKUP OUTPUT.$test_count
+
+test_begin_subtest 'format=notmuch, restore=auto'
+    notmuch dump --format=notmuch > EXPECTED.$test_count
+    notmuch tag -inbox -unread "*"
+    notmuch restore --format=auto < EXPECTED.$test_count
+    notmuch dump --format=notmuch > OUTPUT.$test_count
+test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+
+test_begin_subtest 'format=sup, restore=auto'
+    notmuch dump --format=sup > EXPECTED.$test_count
+    notmuch tag -inbox -unread "*"
+    notmuch restore --format=auto < EXPECTED.$test_count
+    notmuch dump --format=sup > OUTPUT.$test_count
+test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+
+test_begin_subtest 'format=notmuch, restore=default'
+    notmuch dump --format=notmuch > EXPECTED.$test_count
+    notmuch tag -inbox -unread "*"
+    notmuch restore < EXPECTED.$test_count
+    notmuch dump --format=notmuch > OUTPUT.$test_count
+test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+
+test_begin_subtest 'format=sup, restore=default'
+    notmuch dump --format=sup > EXPECTED.$test_count
+    notmuch tag -inbox -unread "*"
+    notmuch restore < EXPECTED.$test_count
+    notmuch dump --format=sup > OUTPUT.$test_count
+test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 
 test_done
-- 
1.7.7.3



More information about the notmuch mailing list