Archive-Zip-SimpleZip
view release on metacpan or search on metacpan
https://github.com/pmqs/Archive-Zip-SimpleZip/issues/2
d683c1d5f5e3c91bfd6beac3187cda6ca232d22c
* uncompr error with content()
https://github.com/pmqs/Archive-Zip-SimpleZip/issues/4
efede5832f33b403c767a458c22fbc7d1f21c672
* remove bad test
9e302ae233c17b70699091fdd947f2fd2b4c0cfa
* update to chmod for read-only
https://github.com/pmqs/Archive-Zip-SimpleZip/issues/2
28135fa2228790e920e102fd444606c926444246
* Error when i try extract file to full path
https://github.com/pmqs/Archive-Zip-SimpleZip/issues/2
6b33be16c82fab8fe3f85b66c2bce21424960c55
* Add Support section
50190d09901a5a188ad308e8a015563b66e65ca6
t/001main.t view on Meta::CPAN
is $z, undef ;
is $SimpleZipError, "Illegal Filename",
" missing filename";
}
SKIP:
{
title "file not writable";
my $lex = LexFile->new(my $zipfile);
chmod 0444, $zipfile
or skip "Cannot create non-writable file", 3 ;
skip "Cannot create non-writable file", 3
if -w $zipfile ;
ok ! -w $zipfile, " zip file not writable";
my $z = Archive::Zip::SimpleZip->new($zipfile) ;
is $z, undef ;
is $SimpleZipError, "Illegal Filename",
" Illegal Filename";
chmod 0777, $zipfile ;
}
{
title "filename undef";
my $z = Archive::Zip::SimpleZip->new(undef);
is $z, undef ;
is $SimpleZipError, "Illegal Filename",
" missing filename";
t/001main.t view on Meta::CPAN
use Fcntl ':mode';
SKIP:
{
title "file cannot be read";
my $lex1 = LexFile->new(my $zipfile);
my $lex = LexFile->new(my $file1);
writeFile($file1, "abc");
chmod 0222, $file1 ;
skip "Cannot create non-readable file", 6
if -r $file1 ;
ok ! -r $file1, " input file not readable";
my $z = Archive::Zip::SimpleZip->new($zipfile) ;
isa_ok $z, "Archive::Zip::SimpleZip";
is $z->add($file1), 0, "add not ok";
is $SimpleZipError, "File '$file1' cannot be read";
ok $z->close, "closed ok";
ok -z $zipfile, "zip file created, but empty";
chmod 0777, $file1 ;
}
SKIP:
{
title "one file cannot be read";
my $lex1 = LexFile->new(my $zipfile);
my $lex2 = LexFile->new(my $file1);
my $lex3 = LexFile->new(my $file2);
my $lex4 = LexFile->new(my $file3);
writeFile($file1, $file1);
writeFile($file2, $file2);
writeFile($file3, $file3);
chmod 0222, $file2 ;
skip "Cannot create non-readable file", 13
if -r $file2 ;
ok ! -r $file2, " input file not readable";
my $z = Archive::Zip::SimpleZip->new($zipfile) ;
isa_ok $z, "Archive::Zip::SimpleZip";
ok $z->add($file1), "add $file1";
t/001main.t view on Meta::CPAN
ok $z->close, "closed ok";
ok -e $zipfile, "zip file created";
my @got = getContent($zipfile);
is @got, 1, "two entries in zip";
is $got[0]{Name}, canonFile($file1);
is $got[0]{Payload}, $file1;
chmod 0777, $file2 ;
}
{
title "simple" ;
my $lex1 = LexFile->new(my $zipfile);
my $lex = LexFile->new(my $file1);
writeFile($file1, "hello world");
t/010main-unzip.t view on Meta::CPAN
is $z, undef ;
like $SimpleUnzipError, qr/cannot open file/,
" missing filename";
}
# SKIP:
# {
# title "file not readable";
# my $lex = LexFile->new(my $zipfile);
# chmod 0444, $zipfile
# or skip "Cannot create non-readable file", 3 ;
# skip "Cannot create non-readable file", 3
# if -r $zipfile ;
# ok ! -r $zipfile, " zip file not readable";
# my $z = Archive::Zip::SimpleUnzip->new($zipfile) ;
# is $z, undef ;
# is $SimpleUnzipError, "Illegal Filename",
# " Illegal Filename";
# chmod 0777, $zipfile ;
# }
{
title "filename undef";
my $z = Archive::Zip::SimpleUnzip->new(undef);
is $z, undef ;
is $SimpleUnzipError, "Illegal Filename",
" missing filename";
t/010main-unzip.t view on Meta::CPAN
title "output file already exists & is writable, so overwrite";
my $out = "f1" ;
writeFile($out, "text");
ok -e $out ;
ok $unzip->extract("f1");
is readFile($out), "abcd1" ;
title "output file already exists & not-writable";
writeFile($out, "text");
chmod 0444, $out ;
ok ! $unzip->extract("f1");
# if $SimpleUnzipError, //;
chmod 0777, $out ;
is readFile($out), "text" ;
title "part of output path exists, but is already a file";
writeFile("d3", "text");
ok -e $out ;
ok ! $unzip->extract("d3/f3");
like $SimpleUnzipError, "/Path is not a directory 'd3'/";
ok ! -e "d3/f3";
}
t/020main-unzip-stream.t view on Meta::CPAN
is $z, undef ;
like $StreamedUnzipError, qr/cannot open file/,
" missing filename";
}
# SKIP:
# {
# title "file not readable";
# my $lex = LexFile->new(my $zipfile);
# chmod 0444, $zipfile
# or skip "Cannot create non-readable file", 3 ;
# skip "Cannot create non-readable file", 3
# if -r $zipfile ;
# ok ! -r $zipfile, " zip file not readable";
# my $z = Archive::Zip::StreamedUnzip->new($zipfile) ;
# is $z, undef ;
# is $StreamedUnzipError, "Illegal Filename",
# " Illegal Filename";
# chmod 0777, $zipfile ;
# }
{
title "filename undef";
my $z = Archive::Zip::StreamedUnzip->new(undef);
is $z, undef ;
is $StreamedUnzipError, "Illegal Filename",
" missing filename";
t/compress/CompTestUtils.pm view on Meta::CPAN
sub new
{
my $self = shift ;
foreach (@_)
{
Carp::croak "NO!!!!" if defined $_;
# autogenerate the name if none supplied
$_ = "tst" . $$ . "X" . $index ++ . ".tmp"
unless defined $_;
}
chmod 0777, @_;
for (@_) { 1 while unlink $_ } ;
bless [ @_ ], $self ;
}
sub DESTROY
{
my $self = shift ;
chmod 0777, @{ $self } ;
for (@$self) { 1 while unlink $_ } ;
}
}
{
package LexDir ;
use File::Path;
( run in 0.262 second using v1.01-cache-2.11-cpan-496ff517765 )