1 Return-Path: <thomas@schwinge.name>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 20F1A431FD0
\r
6 for <notmuch@notmuchmail.org>; Thu, 29 Sep 2011 10:37:24 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id qn+LuFcffirk for <notmuch@notmuchmail.org>;
\r
16 Thu, 29 Sep 2011 10:37:23 -0700 (PDT)
\r
17 Received: from smtprelay02.ispgateway.de (smtprelay02.ispgateway.de
\r
19 by olra.theworths.org (Postfix) with ESMTP id 0D9A1431FB6
\r
20 for <notmuch@notmuchmail.org>; Thu, 29 Sep 2011 10:37:23 -0700 (PDT)
\r
21 Received: from [87.180.87.168] (helo=stokes.schwinge.homeip.net)
\r
22 by smtprelay02.ispgateway.de with esmtpa (Exim 4.68)
\r
23 (envelope-from <thomas@schwinge.name>) id 1R9KXw-00081v-IR
\r
24 for notmuch@notmuchmail.org; Thu, 29 Sep 2011 19:37:20 +0200
\r
25 Received: (qmail 24609 invoked from network); 29 Sep 2011 17:37:14 -0000
\r
26 Received: from kepler.schwinge.homeip.net (192.168.111.7)
\r
27 by stokes.schwinge.homeip.net with QMQP; 29 Sep 2011 17:37:14 -0000
\r
28 Received: (nullmailer pid 29574 invoked by uid 1000);
\r
29 Thu, 29 Sep 2011 17:37:13 -0000
\r
30 From: Thomas Schwinge <thomas@schwinge.name>
\r
31 To: notmuch@notmuchmail.org
\r
32 Subject: [PATCH, v2] notmuch restore --accumulate
\r
33 Date: Thu, 29 Sep 2011 19:36:51 +0200
\r
34 Message-Id: <1317317811-29540-1-git-send-email-thomas@schwinge.name>
\r
35 X-Mailer: git-send-email 1.7.5.4
\r
36 In-Reply-To: <1315249637-20179-1-git-send-email-thomas@schwinge.name>
\r
37 References: <1315249637-20179-1-git-send-email-thomas@schwinge.name>
\r
38 X-Df-Sender: dGhvbWFzQHNjaHdpbmdlLm5hbWU=
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Thu, 29 Sep 2011 17:37:24 -0000
\r
53 From: Thomas Schwinge <thomas@schwinge.name>
\r
55 Flesh out what ``notmuch restore --accumulate'' is supposed to do. Its tests
\r
56 are currently XFAILed; the functionality will be added in another patch.
\r
58 Also generally enhance the dump-restore testsuite, and make it more
\r
62 test/dump-restore | 77 ++++++++++++++++++++++++++++++++++++++++++-----------
\r
63 test/test-lib.sh | 3 +-
\r
64 2 files changed, 63 insertions(+), 17 deletions(-)
\r
66 diff --git a/test/dump-restore b/test/dump-restore
\r
67 index a4de370..d253756 100755
\r
68 --- a/test/dump-restore
\r
69 +++ b/test/dump-restore
\r
70 @@ -4,21 +4,66 @@ test_description="\"notmuch dump\" and \"notmuch restore\""
\r
74 -test_expect_success "Dumping all tags" "generate_message &&
\r
76 -notmuch dump dump.expected"
\r
78 -test_begin_subtest "Clearing all tags"
\r
79 -sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected
\r
80 -notmuch restore clear.expected
\r
81 -notmuch dump clear.actual
\r
82 -test_expect_equal "$(< clear.actual)" "$(< clear.expected)"
\r
84 -test_begin_subtest "Restoring original tags"
\r
85 -notmuch restore dump.expected
\r
86 -notmuch dump dump.actual
\r
87 -test_expect_equal "$(< dump.actual)" "$(< dump.expected)"
\r
89 -test_expect_success "Restore with nothing to do" "notmuch restore dump.expected"
\r
90 +test_expect_success 'Dumping all tags' \
\r
91 + 'generate_message &&
\r
93 + notmuch dump dump.expected'
\r
95 +# This is rather arbitrary: it matches some of the email corpus' messages, but
\r
97 +search_term=from:worth
\r
99 +test_expect_success 'Dumping all tags to stdout' \
\r
100 + 'notmuch tag +ABC +DEF -- $search_term &&
\r
101 + notmuch dump > dump-ABC_DEF.expected &&
\r
102 + ! cmp dump.expected dump-ABC_DEF.expected'
\r
104 +test_expect_success 'Clearing all tags' \
\r
105 + 'sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected &&
\r
106 + notmuch restore clear.expected &&
\r
107 + notmuch dump clear.actual &&
\r
108 + test_cmp clear.expected clear.actual'
\r
110 +# Missing notmuch restore --accumulate.
\r
111 +test_subtest_known_broken
\r
112 +test_expect_success 'Accumulate original tags' \
\r
113 + 'notmuch tag +ABC +DEF -- $search_term &&
\r
114 + notmuch restore --accumulate < dump.expected &&
\r
115 + notmuch dump dump.actual &&
\r
116 + test_cmp dump-ABC_DEF.expected dump.actual'
\r
118 +test_expect_success 'Restoring original tags' \
\r
119 + 'notmuch restore dump.expected &&
\r
120 + notmuch dump dump.actual &&
\r
121 + test_cmp dump.expected dump.actual'
\r
123 +test_expect_success 'Restore with nothing to do' \
\r
124 + 'notmuch restore < dump.expected &&
\r
125 + notmuch dump > dump.actual &&
\r
126 + test_cmp dump.expected dump.actual'
\r
128 +# Missing notmuch restore --accumulate.
\r
129 +test_subtest_known_broken
\r
130 +test_expect_success 'Restore with nothing to do, II' \
\r
131 + 'notmuch restore --accumulate dump.expected &&
\r
132 + notmuch dump dump.actual &&
\r
133 + test_cmp dump.expected dump.actual'
\r
135 +# Missing notmuch restore --accumulate.
\r
136 +test_subtest_known_broken
\r
137 +test_expect_success 'Restore with nothing to do, III' \
\r
138 + 'notmuch restore --accumulate < clear.expected &&
\r
139 + notmuch dump dump.actual &&
\r
140 + test_cmp dump.expected dump.actual'
\r
142 +# notmuch restore currently only considers the first argument.
\r
143 +test_subtest_known_broken
\r
144 +test_expect_success 'Invalid restore invocation' \
\r
145 + 'test_must_fail notmuch restore dump.expected another_one'
\r
147 +# The follwing test already succeeds due to notmuch restore currently only
\r
148 +# considering the first argument.
\r
149 +test_expect_success 'Invalid restore invocation, II' \
\r
150 + 'test_must_fail notmuch restore --accumulate dump.expected another_one'
\r
153 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
154 index f8df6a5..f524ebf 100755
\r
155 --- a/test/test-lib.sh
\r
156 +++ b/test/test-lib.sh
\r
157 @@ -462,6 +462,7 @@ test_expect_equal ()
\r
161 +# Like test_expect_equal, but takes two filenames.
\r
162 test_expect_equal_file ()
\r
164 exec 1>&6 2>&7 # Restore stdout and stderr
\r
165 @@ -724,7 +725,7 @@ test_external_without_stderr () {
\r
169 -# This is not among top-level (test_expect_success | test_expect_failure)
\r
170 +# This is not among top-level (test_expect_success)
\r
171 # but is a prefix that can be used in the test script, like:
\r
173 # test_expect_success 'complain and die' '
\r
175 tg: (f63d605..) t/restore-accumulate-test (depends on: master)
\r