[PATCH 3/4] test/dump-restore: add tests for notmuch restore --match

Subject: [PATCH 3/4] test/dump-restore: add tests for notmuch restore --match

Date: Sat, 29 Oct 2011 00:04:50 -0300

To: notmuch@notmuchmail.org

Cc: David Bremner

From: David Bremner


From: David Bremner <bremner@debian.org>

The first test passes now because it only needs command line parsing.
The other three are marked broken, with functionality to follow.
---
 test/dump-restore |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/test/dump-restore b/test/dump-restore
index c6089f9..18925a4 100755
--- a/test/dump-restore
+++ b/test/dump-restore
@@ -65,6 +65,49 @@ test_expect_equal 'compiling regex notmuch.*[: Invalid regular expression'\
 test_expect_success 'restore --match=<good regex>' \
     'notmuch restore --match="notmuch.*" < /dev/null > /dev/null 2>&1'
 
+test_expect_success 'Restoring with trivial match' \
+  'notmuch restore --match="." dump.expected &&
+  notmuch dump > dump.actual &&
+  test_cmp dump.expected dump.actual'
+
+sed 's/inbox\|unread\|signed//g' < dump-ABC_DEF.expected > dump-ABC_DEF-only
+
+test_subtest_known_broken
+test_expect_success 'Simulate accumulate with match' \
+  'notmuch restore < dump.expected &&
+   notmuch restore --match="(ABC|DEF)" < dump-ABC_DEF-only &&
+   notmuch dump > dump-simulate.actual &&
+   notmuch restore < dump.expected &&
+   test_cmp dump-ABC_DEF.expected dump-simulate.actual'
+
+test_subtest_known_broken
+test_expect_success 'clear only matched tags' \
+  'notmuch restore < dump-ABC_DEF.expected &&
+   notmuch restore --match="(ABC|DEF)" < clear.expected &&
+   notmuch dump > dump-clear-match.actual &&
+   notmuch restore < dump.expected &&
+   test_cmp dump.expected dump-clear-match.actual'
+
+test_subtest_known_broken
+test_expect_success 'import only matched tags' \
+  'notmuch restore < dump.expected &&
+   notmuch restore --match="(inbox|unread)" < dump-ABC_DEF.expected &&
+   notmuch dump > dump-import-match.actual &&
+   notmuch restore < dump.expected &&
+   test_cmp dump.expected dump-import-match.actual'
+
+sed 's/inbox\|unread\|signed\|ABC//g' < dump-ABC_DEF.expected > dump-DEF-only
+sed 's/inbox\|unread\|signed\|DEF//g' < dump-ABC_DEF.expected > dump-ABC-only
+
+test_subtest_known_broken
+test_expect_success 'combine --match and --accumulate' \
+  'notmuch restore < dump.expected &&
+   notmuch restore --match="(ABC|DEF)" < dump-ABC-only &&
+   notmuch restore --accumulate --match="(ABC|DEF)" < dump-DEF-only &&
+   notmuch dump > dump-combine-match.actual &&
+   notmuch restore < dump.expected &&
+   test_cmp dump-ABC_DEF.expected dump-combine-match.actual'
+
 test_begin_subtest "dump outfile"
 notmuch dump dump-outfile.actual
 test_expect_equal_file dump.expected dump-outfile.actual
-- 
1.7.6.3


Thread: