From 7043dac286be2ce0ee23303b16692db73651f3ae Mon Sep 17 00:00:00 2001 From: Paul Marquess Date: Tue, 11 Oct 2005 13:35:22 +0100 Subject: [PATCH] Compress::Zlib From: "Paul Marquess" Message-ID: <013e01c5ce57$dee62af0$671c140a@myopwv.com> p4raw-id: //depot/perl@25735 --- ext/Compress/Zlib/lib/Compress/Zlib/Common.pm | 1 + ext/Compress/Zlib/t/16oneshot.t | 42 ++++++++++----------------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/ext/Compress/Zlib/lib/Compress/Zlib/Common.pm b/ext/Compress/Zlib/lib/Compress/Zlib/Common.pm index 1106105..443d9b3 100644 --- a/ext/Compress/Zlib/lib/Compress/Zlib/Common.pm +++ b/ext/Compress/Zlib/lib/Compress/Zlib/Common.pm @@ -27,6 +27,7 @@ sub setBinModeInput($) { my $handle = shift ; + binmode $handle ; #binmode $handle if $] == 5.008 ; #binmode $handle unless isSTDIN($handle) ; } diff --git a/ext/Compress/Zlib/t/16oneshot.t b/ext/Compress/Zlib/t/16oneshot.t index 3310111..7c24fba 100644 --- a/ext/Compress/Zlib/t/16oneshot.t +++ b/ext/Compress/Zlib/t/16oneshot.t @@ -23,18 +23,18 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 2526 + $extra ; + plan tests => 2462 + $extra ; use_ok('Compress::Zlib', 2) ; - use_ok('IO::Compress::Gzip', qw(gzip $GzipError)) ; - use_ok('IO::Uncompress::Gunzip', qw(gunzip $GunzipError)) ; + use_ok('IO::Compress::Gzip', qw($GzipError)) ; + use_ok('IO::Uncompress::Gunzip', qw($GunzipError)) ; - use_ok('IO::Compress::Deflate', qw(deflate $DeflateError)) ; - use_ok('IO::Uncompress::Inflate', qw(inflate $InflateError)) ; + use_ok('IO::Compress::Deflate', qw($DeflateError)) ; + use_ok('IO::Uncompress::Inflate', qw($InflateError)) ; - use_ok('IO::Compress::RawDeflate', qw(rawdeflate $RawDeflateError)) ; - use_ok('IO::Uncompress::RawInflate', qw(rawinflate $RawInflateError)) ; + use_ok('IO::Compress::RawDeflate', qw($RawDeflateError)) ; + use_ok('IO::Uncompress::RawInflate', qw($RawInflateError)) ; use_ok('IO::Uncompress::AnyInflate', qw(anyinflate $AnyInflateError)) ; @@ -1064,7 +1064,7 @@ foreach my $bit ('IO::Uncompress::Gunzip', my $lex = new LexFile($in_file) ; writeFile($in_file, $comp); - ok open(SAVEIN, "<&STDIN"), " save STDIN"; + open(SAVEIN, "<&STDIN"); my $dummy = fileno SAVEIN ; ok open(STDIN, "<$in_file"), " redirect STDIN"; @@ -1074,7 +1074,7 @@ foreach my $bit ('IO::Uncompress::Gunzip', ok &$Func('-', \$output, Append => $append), ' Uncompressed ok' or diag $$Error ; - ok open(STDIN, "<&SAVEIN"), " put STDIN back"; + open(STDIN, "<&SAVEIN"); is $keep_comp, $comp, " Input buffer not changed" ; is $output, $expected, " Uncompressed matches original"; @@ -1117,14 +1117,13 @@ foreach my $bit ('IO::Uncompress::Gunzip', { title "$TopType - From stdin (via $stdin) to Buffer content, InputLength" ; - my $in_file = "abcde.in"; - my $lex = new LexFile($in_file) ; + my $lex = new LexFile my $in_file ; my $expected = $buffer ; my $appended = 'appended'; my $len_appended = length $appended; - writeFile($in_file, $comp . $appended . $comp . $appended) ; + writeFile($in_file, $comp . $appended ) ; - ok open(SAVEIN, "<&STDIN"), " save STDIN"; + open(SAVEIN, "<&STDIN"); my $dummy = fileno SAVEIN ; ok open(STDIN, "<$in_file"), " redirect STDIN"; @@ -1139,18 +1138,7 @@ foreach my $bit ('IO::Uncompress::Gunzip', is $output, $expected, " Uncompressed matches original"; is $buff, $appended, " Appended data ok"; - $output = ''; - ok &$Func($stdin, \$output, Transparent => 0, InputLength => length $comp), ' Uncompressed ok' - or diag $$Error ; - - $buff = ''; - is read(STDIN, $buff, $len_appended), $len_appended, " Length of Appended data ok" - or diag "read failed $!"; - - is $output, $expected, " Uncompressed matches original"; - is $buff, $appended, " Appended data ok"; - - ok open(STDIN, "<&SAVEIN"), " put STDIN back"; + open(STDIN, "<&SAVEIN"); } } @@ -1387,8 +1375,8 @@ foreach my $TopType ('IO::Compress::Gzip::gzip', my $got = anyUncompress(\$Answer); is $got, $get, " got expected output" ; - cmp_ok $$Error, '==', 0, " no error"; - + ok ! $$Error, " no error" + or diag "Error is $$Error"; } -- 2.7.4