summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPaul Marquess <paul.marquess@btinternet.com>2006-04-14 10:05:39 +0100
committerSteve Peters <steve@fisharerojo.org>2006-04-14 12:16:01 +0000
commit2b4e0969009806e4e03a23b007570fa5279be8e0 (patch)
tree8d51143cff1d164a57df651f42b06a0b65da0951 /t
parent1a159fba18a77552673669d932364b0c4ea1852e (diff)
downloadperl-2b4e0969009806e4e03a23b007570fa5279be8e0.tar.gz
IO::Compress::*
Message-ID: <004f01c65f9a$3871eb30$2405140a@myopwv.com> p4raw-id: //depot/perl@27799
Diffstat (limited to 't')
-rw-r--r--t/lib/compress/generic.pl92
1 files changed, 53 insertions, 39 deletions
diff --git a/t/lib/compress/generic.pl b/t/lib/compress/generic.pl
index 884c416ea7..04132fecca 100644
--- a/t/lib/compress/generic.pl
+++ b/t/lib/compress/generic.pl
@@ -18,7 +18,7 @@ BEGIN
$extra = 1
if $st ;
- plan(tests => 601 + $extra) ;
+ plan(tests => 615 + $extra) ;
}
sub myGZreadFile
@@ -1110,51 +1110,65 @@ EOT
foreach my $type (qw(buffer filename filehandle))
{
- title "$UncompressClass -- InputLength, read from $type";
+ foreach my $good (0, 1)
+ {
+ title "$UncompressClass -- InputLength, read from $type, good data => $good";
- my $compressed ;
- my $string = "some data";
- my $c = new $CompressClass(\$compressed);
- $c->write($string);
- $c->close();
+ my $compressed ;
+ my $string = "some data";
+ my $appended = "append";
- my $appended = "append";
- my $comp_len = length $compressed;
- $compressed .= $appended;
+ if ($good)
+ {
+ my $c = new $CompressClass(\$compressed);
+ $c->write($string);
+ $c->close();
+ }
+ else
+ {
+ $compressed = $string ;
+ }
- my $lex = new LexFile my $name ;
- my $input ;
- writeFile ($name, $compressed);
+ my $comp_len = length $compressed;
+ $compressed .= $appended;
- if ($type eq 'buffer')
- {
- $input = \$compressed;
- }
- if ($type eq 'filename')
- {
- $input = $name;
- }
- elsif ($type eq 'filehandle')
- {
- my $fh = new IO::File "<$name" ;
- ok $fh, "opened file $name ok";
- $input = $fh ;
- }
+ my $lex = new LexFile my $name ;
+ my $input ;
+ writeFile ($name, $compressed);
- my $x = new $UncompressClass($input, InputLength => $comp_len) ;
- ok $x, " created $UncompressClass";
+ if ($type eq 'buffer')
+ {
+ $input = \$compressed;
+ }
+ if ($type eq 'filename')
+ {
+ $input = $name;
+ }
+ elsif ($type eq 'filehandle')
+ {
+ my $fh = new IO::File "<$name" ;
+ ok $fh, "opened file $name ok";
+ $input = $fh ;
+ }
- my $len ;
- my $output;
- $len = $x->read($output, 100);
- is $len, length($string);
- is $output, $string;
+ my $x = new $UncompressClass($input,
+ InputLength => $comp_len,
+ Transparent => 1) ;
+ ok $x, " created $UncompressClass";
- if ($type eq 'filehandle')
- {
- my $rest ;
- $input->read($rest, 1000);
- is $rest, $appended;
+ my $len ;
+ my $output;
+ $len = $x->read($output, 100);
+
+ is $len, length($string);
+ is $output, $string;
+
+ if ($type eq 'filehandle')
+ {
+ my $rest ;
+ $input->read($rest, 1000);
+ is $rest, $appended;
+ }
}