git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] t9700: Use Test::More->builder, not $Test::Builder::Test

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 26, 2010, 12:42 UTC
Message-ID
<1277556161-8718-1-git-send-email-avarab@gmail.com>
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
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 15 of 16 in “TAP support for Git”
  1. 0/5 TAP support for GitÆvar Arnfjörð Bjarmason, Jun 24, 2010
  2. 1/5 test-lib: Adjust output to be valid TAP formatÆvar Arnfjörð Bjarmason, Jun 24, 2010
  3. Jakub NarebskiJun 24, 2010
  4. Ævar Arnfjörð BjarmasonJun 24, 2010
  5. 1/5 test-lib: Adjust output to be valid TAP formatÆvar Arnfjörð Bjarmason, Jun 24, 2010
  6. Junio C HamanoJun 25, 2010
  7. Ævar Arnfjörð BjarmasonJun 25, 2010
  8. Junio C HamanoJun 25, 2010
  9. Ævar Arnfjörð BjarmasonJun 25, 2010
  10. 2/5 test-lib: Make the test_external_* functions TAP-awareÆvar Arnfjörð Bjarmason, Jun 24, 2010
  11. 3/5 test-lib: output a newline before "ok" under a TAP harnessÆvar Arnfjörð Bjarmason, Jun 24, 2010
  12. 4/5 tests: Skip tests in a way that makes sense under TAPÆvar Arnfjörð Bjarmason, Jun 24, 2010
  13. 5/5 tests: Say "pass" rather than "ok" on empty lines for TAPÆvar Arnfjörð Bjarmason, Jun 24, 2010
  14. t9700: Use Test::More->builder, not $Test::Builder::TestÆvar Arnfjörð Bjarmason, Jun 26, 2010
  15. t9700: Use Test::More->builder, not $Test::Builder::TestÆvar Arnfjörð Bjarmason, Jun 26, 2010
  16. Junio C HamanoJun 27, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.