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