git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v2] t9700: Use Test::More->builder, not $Test::Builder::Test
Date: Sat, 26 Jun 2010 12:42:41 +0000	[thread overview]
Message-ID: <1277556161-8718-1-git-send-email-avarab@gmail.com> (raw)
In-Reply-To: <1277554872-6402-1-git-send-email-avarab@gmail.com>

$Test::Builder::Test was only made into an `our' variable in 0.94
released in September 2009, older distros are more likely to have 0.92
or earlier. Use the singleton Test::More->builder constructor instead.

The exit() call was also unportable to <0.94. Just output a meaningful
exit code if the ->is_passing method exists. The t9700-perl-git.sh
test only cares about stderr output, so this doesn't affect test
results when using older Test::More modules.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

The previous patch didn't take into account that the exit() call was
also unportable. Oops.

 t/t9700/test.pl |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index e5d4b03..f2820d2 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -10,8 +10,8 @@ use Test::More qw(no_plan);
 BEGIN {
 	# t9700-perl-git.sh kicks off our testing, so we have to go from
 	# there.
-	$Test::Builder::Test->{Curr_Test} = 1;
-	$Test::Builder::Test->{No_Ending} = 1;
+	Test::More->builder->{Curr_Test} = 1;
+	Test::More->builder->{No_Ending} = 1;
 }
 
 use Cwd;
@@ -113,6 +113,7 @@ like($last_commit, qr/^[0-9a-fA-F]{40}$/, 'rev-parse returned hash');
 my $dir_commit = $r2->command_oneline('log', '-n1', '--pretty=format:%H', '.');
 isnt($last_commit, $dir_commit, 'log . does not show last commit');
 
-printf "1..%d\n", $Test::Builder::Test->{Curr_Test};
+printf "1..%d\n", Test::More->builder->{Curr_Test};
 
-exit($Test::Builder::Test->{Is_Passing} ? 0 : 1);
+my $is_passing = eval { Test::More->is_passing };
+exit($is_passing ? 0 : 1) unless $@ =~ /Can't locate object method/;
-- 
1.7.1.251.g92a7

  reply	other threads:[~2010-06-26 12:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-24 17:44 [PATCH v4 0/5] TAP support for Git Ævar Arnfjörð Bjarmason
2010-06-24 17:44 ` [PATCH v4 1/5] test-lib: Adjust output to be valid TAP format Ævar Arnfjörð Bjarmason
2010-06-24 18:39   ` Jakub Narebski
2010-06-24 19:17     ` Ævar Arnfjörð Bjarmason
2010-06-24 21:52       ` [PATCH v5 " Ævar Arnfjörð Bjarmason
2010-06-25 17:21         ` Junio C Hamano
2010-06-25 21:24           ` Ævar Arnfjörð Bjarmason
2010-06-25 21:36             ` Junio C Hamano
2010-06-25 21:39               ` Ævar Arnfjörð Bjarmason
2010-06-24 17:44 ` [PATCH v4 2/5] test-lib: Make the test_external_* functions TAP-aware Ævar Arnfjörð Bjarmason
2010-06-24 17:44 ` [PATCH v4 3/5] test-lib: output a newline before "ok" under a TAP harness Ævar Arnfjörð Bjarmason
2010-06-24 17:44 ` [PATCH v4 4/5] tests: Skip tests in a way that makes sense under TAP Ævar Arnfjörð Bjarmason
2010-06-24 17:44 ` [PATCH v4 5/5] tests: Say "pass" rather than "ok" on empty lines for TAP Ævar Arnfjörð Bjarmason
2010-06-26 12:21 ` [PATCH] t9700: Use Test::More->builder, not $Test::Builder::Test Ævar Arnfjörð Bjarmason
2010-06-26 12:42   ` Ævar Arnfjörð Bjarmason [this message]
2010-06-27 18:27     ` [PATCH v2] " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1277556161-8718-1-git-send-email-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).