[PATCH 2/6] test/dump-restore: expand test suite for dump-restore, make more robust
authorDavid Bremner <david@tethera.net>
Fri, 21 Oct 2011 19:47:53 +0000 (16:47 +2100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:39:42 +0000 (09:39 -0800)
2a/23fe6bf093ced6b06bc651cf783cb9d65639c5 [new file with mode: 0644]

diff --git a/2a/23fe6bf093ced6b06bc651cf783cb9d65639c5 b/2a/23fe6bf093ced6b06bc651cf783cb9d65639c5
new file mode 100644 (file)
index 0000000..0691422
--- /dev/null
@@ -0,0 +1,125 @@
+Return-Path: <bremner@pivot.cs.unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 51A4C431FD0\r
+       for <notmuch@notmuchmail.org>; Fri, 21 Oct 2011 12:48:14 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id zOxfEoFxlJEt for <notmuch@notmuchmail.org>;\r
+       Fri, 21 Oct 2011 12:48:12 -0700 (PDT)\r
+Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 63406429E29\r
+       for <notmuch@notmuchmail.org>; Fri, 21 Oct 2011 12:48:11 -0700 (PDT)\r
+Received: from convex-new.cs.unb.ca ([131.202.13.154])\r
+       by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id p9LJm42D002201;\r
+       Fri, 21 Oct 2011 16:48:07 -0300\r
+Received: from bremner by convex-new.cs.unb.ca with local (Exim 4.72)\r
+       (envelope-from <bremner@pivot.cs.unb.ca>)\r
+       id 1RHL4W-00016O-Qe; Fri, 21 Oct 2011 16:48:04 -0300\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/6] test/dump-restore: expand test suite for dump-restore,\r
+       make more robust\r
+Date: Fri, 21 Oct 2011 16:47:53 -0300\r
+Message-Id: <1319226477-4181-3-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.7.5.4\r
+In-Reply-To: <1319226477-4181-1-git-send-email-david@tethera.net>\r
+References: <1317317857-29636-1-git-send-email-thomas@schwinge.name>\r
+       <1319226477-4181-1-git-send-email-david@tethera.net>\r
+Cc: David Bremner <bremner@debian.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 21 Oct 2011 19:48:14 -0000\r
+\r
+From: David Bremner <bremner@debian.org>\r
+\r
+Several new tests are added, and existing use of test_begin_subtest is\r
+replaced by test_expect_success to catch failing commands in cases where\r
+we execute more than one command.\r
+\r
+Based on changes in\r
+\r
+      id:"1317317811-29540-1-git-send-email-thomas@schwinge.name"\r
+---\r
+ test/dump-restore |   41 +++++++++++++++++++++++++----------------\r
+ 1 files changed, 25 insertions(+), 16 deletions(-)\r
+\r
+diff --git a/test/dump-restore b/test/dump-restore\r
+index de85693..502fb82 100755\r
+--- a/test/dump-restore\r
++++ b/test/dump-restore\r
+@@ -4,9 +4,31 @@ test_description="\"notmuch dump\" and \"notmuch restore\""\r
\r
+ add_email_corpus\r
\r
+-test_expect_success "Dumping all tags" "generate_message &&\r
+-notmuch new &&\r
+-notmuch dump > dump.expected"\r
++test_expect_success 'Dumping all tags' \\r
++  'generate_message &&\r
++  notmuch new &&\r
++  notmuch dump > dump.expected'\r
++\r
++test_expect_success 'Clearing all tags' \\r
++  'sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected &&\r
++  notmuch restore clear.expected &&\r
++  notmuch dump > clear.actual &&\r
++  test_cmp clear.expected clear.actual'\r
++\r
++test_expect_success 'Restoring original tags' \\r
++  'notmuch restore dump.expected &&\r
++  notmuch dump > dump.actual &&\r
++  test_cmp dump.expected dump.actual'\r
++\r
++test_expect_success 'Restore with nothing to do' \\r
++  'notmuch restore < dump.expected &&\r
++  notmuch dump > dump.actual &&\r
++  test_cmp dump.expected dump.actual'\r
++\r
++# notmuch restore currently only considers the first argument.\r
++test_subtest_known_broken\r
++test_expect_success 'Invalid restore invocation' \\r
++  'test_must_fail notmuch restore dump.expected another_one'\r
\r
+ test_begin_subtest "dump outfile"\r
+ notmuch dump dump-outfile.actual\r
+@@ -37,17 +59,4 @@ test_begin_subtest "dump outfile -- from:cworth"\r
+ notmuch dump dump-outfile-dash-inbox.actual -- from:cworth\r
+ test_expect_equal_file dump-cworth.expected dump-outfile-dash-inbox.actual\r
\r
+-test_begin_subtest "Clearing all tags"\r
+-sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected\r
+-notmuch restore < clear.expected\r
+-notmuch dump > clear.actual\r
+-test_expect_equal "$(< clear.actual)" "$(< clear.expected)"\r
+-\r
+-test_begin_subtest "Restoring original tags"\r
+-notmuch restore < dump.expected\r
+-notmuch dump > dump.actual\r
+-test_expect_equal "$(< dump.actual)" "$(< dump.expected)"\r
+-\r
+-test_expect_success "Restore with nothing to do" "notmuch restore dump.expected"\r
+-\r
+ test_done\r
+-- \r
+1.7.5.4\r
+\r