diff options
Diffstat (limited to 'cpan/IO-Compress/t')
-rw-r--r-- | cpan/IO-Compress/t/000prereq.t | 2 | ||||
-rw-r--r-- | cpan/IO-Compress/t/cz-03zlib-v1.t | 34 | ||||
-rw-r--r-- | cpan/IO-Compress/t/cz-14gzopen.t | 17 |
3 files changed, 42 insertions, 11 deletions
diff --git a/cpan/IO-Compress/t/000prereq.t b/cpan/IO-Compress/t/000prereq.t index d861811720..7ae90c5ffb 100644 --- a/cpan/IO-Compress/t/000prereq.t +++ b/cpan/IO-Compress/t/000prereq.t @@ -25,7 +25,7 @@ BEGIN if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - my $VERSION = '2.048'; + my $VERSION = '2.049'; my @NAMES = qw( Compress::Raw::Bzip2 Compress::Raw::Zlib diff --git a/cpan/IO-Compress/t/cz-03zlib-v1.t b/cpan/IO-Compress/t/cz-03zlib-v1.t index 8b804cbee9..a85ed10e27 100644 --- a/cpan/IO-Compress/t/cz-03zlib-v1.t +++ b/cpan/IO-Compress/t/cz-03zlib-v1.t @@ -26,7 +26,7 @@ BEGIN $count = 453 ; } else { - $count = 464 ; + $count = 471 ; } @@ -1231,20 +1231,38 @@ sub trickle { - title "repeated calls to flush"; + title "repeated calls to flush - no compression"; + + my ($err, $x, $X, $status, $data); + + ok( ($x, $err) = deflateInit ( ), "Create deflate object" ); + isa_ok $x, "Compress::Raw::Zlib::deflateStream" ; + cmp_ok $err, '==', Z_OK, "status is Z_OK" ; + + + ($data, $status) = $x->flush(Z_SYNC_FLUSH) ; + cmp_ok $status, '==', Z_OK, "flush returned Z_OK" ; + ($data, $status) = $x->flush(Z_SYNC_FLUSH) ; + cmp_ok $status, '==', Z_OK, "second flush returned Z_OK" ; + is $data, "", "no output from second flush"; +} + +{ + title "repeated calls to flush - after compression"; my $hello = "I am a HAL 9000 computer" ; - my ($err, $x, $X, $status); + my ($err, $x, $X, $status, $data); ok( ($x, $err) = deflateInit ( ), "Create deflate object" ); isa_ok $x, "Compress::Raw::Zlib::deflateStream" ; cmp_ok $err, '==', Z_OK, "status is Z_OK" ; - $status = $x->deflate($hello, $X) ; + ($data, $status) = $x->deflate($hello) ; cmp_ok $status, '==', Z_OK, "deflate returned Z_OK" ; - cmp_ok $x->flush($X, Z_SYNC_FLUSH), '==', Z_OK, "flush returned Z_OK" ; - $X = ''; - cmp_ok $x->flush($X, Z_SYNC_FLUSH), '==', Z_OK, "second flush returned Z_OK" ; - is $X, "", "no output from second flush"; + ($data, $status) = $x->flush(Z_SYNC_FLUSH) ; + cmp_ok $status, '==', Z_OK, "flush returned Z_OK" ; + ($data, $status) = $x->flush(Z_SYNC_FLUSH) ; + cmp_ok $status, '==', Z_OK, "second flush returned Z_OK" ; + is $data, "", "no output from second flush"; } diff --git a/cpan/IO-Compress/t/cz-14gzopen.t b/cpan/IO-Compress/t/cz-14gzopen.t index 0918ce5482..d5f0ea0c04 100644 --- a/cpan/IO-Compress/t/cz-14gzopen.t +++ b/cpan/IO-Compress/t/cz-14gzopen.t @@ -20,7 +20,7 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 260 + $extra ; + plan tests => 264 + $extra ; use_ok('Compress::Zlib', 2) ; use_ok('IO::Compress::Gzip::Constants') ; @@ -651,7 +651,20 @@ foreach my $stdio ( ['-', '-'], [*STDIN, *STDOUT]) } { - title 'gzflush called twice'; + title 'gzflush called twice with Z_SYNC_FLUSH - no compression'; + + my $lex = new LexFile my $name ; + + ok my $a = gzopen($name, "w"); + + is $a->gzflush(Z_SYNC_FLUSH), Z_OK, "gzflush returns Z_OK"; + is $a->gzflush(Z_SYNC_FLUSH), Z_OK, "gzflush returns Z_OK"; +} + + + +{ + title 'gzflush called twice - after compression'; my $lex = new LexFile my $name ; |