Compress::Zlib
authorPaul Marquess <paul.marquess@btinternet.com>
Tue, 11 Oct 2005 12:35:22 +0000 (13:35 +0100)
committerH.Merijn Brand <h.m.brand@xs4all.nl>
Tue, 11 Oct 2005 11:25:46 +0000 (11:25 +0000)
From: "Paul Marquess" <Paul.Marquess@ntlworld.com>
Message-ID: <013e01c5ce57$dee62af0$671c140a@myopwv.com>

p4raw-id: //depot/perl@25735

ext/Compress/Zlib/lib/Compress/Zlib/Common.pm
ext/Compress/Zlib/t/16oneshot.t

index 1106105..443d9b3 100644 (file)
@@ -27,6 +27,7 @@ sub setBinModeInput($)
 {
     my $handle = shift ;
 
+    binmode $handle ;
     #binmode $handle if $] == 5.008 ;
     #binmode $handle unless isSTDIN($handle) ;
 }
index 3310111..7c24fba 100644 (file)
@@ -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";
 
     }