[PATCH 4/5] test: Detect unfinished subsets
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 14 Nov 2010 21:54:31 +0000 (22:54 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:37:30 +0000 (09:37 -0800)
00/e41e57ff8efa72eae8b7a39842109f1dc70f26 [new file with mode: 0644]

diff --git a/00/e41e57ff8efa72eae8b7a39842109f1dc70f26 b/00/e41e57ff8efa72eae8b7a39842109f1dc70f26
new file mode 100644 (file)
index 0000000..30f8d18
--- /dev/null
@@ -0,0 +1,99 @@
+Return-Path: <sojkam1@fel.cvut.cz>\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 4D7CA40DBC9\r
+       for <notmuch@notmuchmail.org>; Sun, 14 Nov 2010 13:55:08 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+       tests=[BAYES_00=-1.9] autolearn=ham\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 v8WRz8cUu8db for <notmuch@notmuchmail.org>;\r
+       Sun, 14 Nov 2010 13:54:54 -0800 (PST)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id 4909140DBD2\r
+       for <notmuch@notmuchmail.org>; Sun, 14 Nov 2010 13:54:42 -0800 (PST)\r
+Received: from localhost (unknown [192.168.200.4])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id 9E84B19F3336;\r
+       Sun, 14 Nov 2010 22:54:41 +0100 (CET)\r
+X-Virus-Scanned: IMAP AMAVIS\r
+Received: from max.feld.cvut.cz ([192.168.200.1])\r
+       by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
+       port 10044)\r
+       with ESMTP id lbxxtHJeAz-M; Sun, 14 Nov 2010 22:54:40 +0100 (CET)\r
+Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id 0D44619F3345;\r
+       Sun, 14 Nov 2010 22:54:40 +0100 (CET)\r
+Received: from steelpick.2x.cz (unknown [213.29.198.144])\r
+       (Authenticated sender: sojkam1)\r
+       by imap.feld.cvut.cz (Postfix) with ESMTPSA id 03B40FA004;\r
+       Sun, 14 Nov 2010 22:54:40 +0100 (CET)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.72)\r
+       (envelope-from <sojkam1@fel.cvut.cz>)\r
+       id 1PHkX1-0002P6-Ie; Sun, 14 Nov 2010 22:54:39 +0100\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 4/5] test: Detect unfinished subsets\r
+Date: Sun, 14 Nov 2010 22:54:31 +0100\r
+Message-Id: <1289771672-9204-4-git-send-email-sojkam1@fel.cvut.cz>\r
+X-Mailer: git-send-email 1.7.2.3\r
+In-Reply-To: <87hbfjr2sr.fsf@steelpick.2x.cz>\r
+References: <87hbfjr2sr.fsf@steelpick.2x.cz>\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: Sun, 14 Nov 2010 21:55:08 -0000\r
+\r
+When test_begin_subtest is not followed by corresponding test_expect_equal,\r
+the output of the rest of the test script is errornously suppressed. Add\r
+code to detect these bugs in test scripts.\r
+---\r
+ test/test-lib.sh |    6 ++++++\r
+ 1 files changed, 6 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index dce9077..04a4c14 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -396,12 +396,17 @@ add_email_corpus ()\r
\r
+ test_begin_subtest ()\r
+ {\r
++    if [ -n "$inside_subtest" ]; then\r
++      exec 1>&6 2>&7          # Restore stdout and stderr\r
++      error "bug in test script: Missing test_expect_equal in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}"\r
++    fi\r
+     test_subtest_name="$1"\r
+     # Remember stdout and stderr file descriptios and redirect test\r
+     # output to the previously prepared file descriptors 3 and 4 (see\r
+     # bellow)\r
+     if test "$verbose" != "t"; then exec 4>test.output 3>&4; fi\r
+     exec 6>&1 7>&2 >&3 2>&4\r
++    inside_subtest=t\r
+ }\r
\r
+ # Pass test if two arguments match\r
+@@ -413,6 +418,7 @@ test_begin_subtest ()\r
+ test_expect_equal ()\r
+ {\r
+       exec 1>&6 2>&7          # Restore stdout and stderr\r
++      inside_subtest=\r
+       test "$#" = 3 && { prereq=$1; shift; } || prereq=\r
+       test "$#" = 2 ||\r
+       error "bug in the test script: not 2 or 3 parameters to test_expect_equal"\r
+-- \r
+1.7.2.3\r
+\r