From: Michael Hendricks <michael@ndrix.org>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Michael Hendricks <michael@ndrix.org>
Subject: [PATCH] Remove dependency on IO::String from Git.pm test
Date: Wed, 18 Jun 2008 07:37:04 -0600 [thread overview]
Message-ID: <1213796224-995-1-git-send-email-michael@ndrix.org> (raw)
Instead of using IO::String to create an in-memory filehandle, use
open() with a scalar reference as the filename. This feature has been
available since Perl 5.8.0 (which was released in 2002), so it should
be available pretty much everywhere by now.
Signed-off-by: Michael Hendricks <michael@ndrix.org>
---
This patch should apply on top of Junio's lw/perlish branch.
t/t9700/test.pl | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index 8318fec..e34c01e 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -9,7 +9,6 @@ use Test::More qw(no_plan);
use Cwd;
use File::Basename;
use File::Temp;
-use IO::String;
BEGIN { use_ok('Git') }
@@ -69,20 +68,21 @@ is($r->ident_person("Name", "email", "123 +0000"), "Name <email>",
# objects and hashes
ok(our $file1hash = $r->command_oneline('rev-parse', "HEAD:file1"), "(get file hash)");
-our $iostring = IO::String->new;
+my $output;
+open our $iostring, '>', \$output;
is($r->cat_blob($file1hash, $iostring), 15, "cat_blob: size");
-is(${$iostring->string_ref}, "changed file 1\n", "cat_blob: data");
+is($output, "changed file 1\n", "cat_blob: data");
our $tmpfile = File::Temp->new();
-print $tmpfile ${$iostring->string_ref};
+print $tmpfile $output;
is(Git::hash_object("blob", $tmpfile), $file1hash, "hash_object: roundtrip");
$tmpfile = File::Temp->new();
print $tmpfile my $test_text = "test blob, to be inserted\n";
$tmpfile->close;
like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/,
"hash_and_insert_object: returns hash");
-$iostring = IO::String->new;
+open $iostring, '>', \$output;
is($r->cat_blob($newhash, $iostring), length $test_text, "cat_blob: roundtrip size");
-is(${$iostring->string_ref}, $test_text, "cat_blob: roundtrip data");
+is($output, $test_text, "cat_blob: roundtrip data");
# paths
is($r->repo_path, "./.git", "repo_path");
--
1.5.5.23.g2a5fe
next reply other threads:[~2008-06-18 13:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-18 13:37 Michael Hendricks [this message]
2008-06-18 14:46 ` [PATCH] Remove dependency on IO::String from Git.pm test Jakub Narebski
2008-06-18 15:10 ` Rafael Garcia-Suarez
2008-06-18 17:00 ` Johannes Schindelin
2008-06-18 17:52 ` Jakub Narebski
2008-06-18 19:35 ` Johannes Schindelin
2008-06-18 19:42 ` Lea Wiemann
2008-06-18 19:13 ` Junio C Hamano
2008-06-18 19:37 ` Johannes Schindelin
2008-06-19 18:25 ` Lea Wiemann
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=1213796224-995-1-git-send-email-michael@ndrix.org \
--to=michael@ndrix.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.