Update Compression modules to version 2.012
[p5sagit/p5-mst-13.2.git] / ext / IO_Compress_Zlib / t / 006zip.t
index 13b6ad7..fdb28ee 100644 (file)
@@ -19,7 +19,7 @@ BEGIN {
     $extra = 1
         if eval { require Test::NoWarnings ;  import Test::NoWarnings; 1 };
 
-    plan tests => 62 + $extra ;
+    plan tests => 77 + $extra ;
 
     use_ok('IO::Compress::Zip', qw(:all)) ;
     use_ok('IO::Uncompress::Unzip', qw(unzip $UnzipError)) ;
@@ -248,3 +248,29 @@ SKIP:
     is $got[2], $content[2], "Got 3nd entry";
 }
 
+
+SKIP:
+for my $method (ZIP_CM_DEFLATE, ZIP_CM_STORE, ZIP_CM_BZIP2)
+{
+    title "Read a line from zip, Method $method";
+
+    skip "IO::Compress::Bzip2 not available", 14
+        unless defined $IO::Compress::Bzip2::VERSION;
+
+    my $content = "a single line\n";
+    my $zip ;
+
+    my $status = zip \$content => \$zip, 
+                    Method => $method, 
+                    Stream => 0, 
+                    Name => "123";
+    is $status, 1, "  Created a zip file";
+
+    my $u = new IO::Uncompress::Unzip \$zip;
+    isa_ok $u, "IO::Uncompress::Unzip";
+
+    is $u->getline, $content, "  Read first line ok";
+    ok ! $u->getline, "  Second line doesn't exist";
+
+
+}