Archive-Any-Lite

 view release on metacpan or  search on metacpan

t/30_fork.t  view on Meta::CPAN

});

my $tmp = "$FindBin::Bin/tmp";
mkpath $tmp;
for my $i (1..100) {
  $pm->start and next;
  my $dir = tempdir(DIR => $tmp, CLEANUP => 1);
  my $type = qw(lib)[int(rand(1))];
  my $ext = qw(tar.gz tar.bz2 tgz zip)[int(rand(4))];

  my ($ok, $not_ok) = (0, 0);
  if (my $archive = Archive::Any::Lite->new("$FindBin::Bin/$type.$ext")) {
    note "extracting $dir/$type.$ext";
    $archive->extract($dir);
    my @files = $archive->files;
    for (@files) {
      my $file = File::Spec->catfile($dir, $_);
      if (-e $file) {
        $ok++;
      }
      else {
        $not_ok++;
        diag "[$i] $type: $file does not exist";
      }
    }
  }
  else {
    $not_ok = 1;
  }
  $pm->finish($not_ok, [$ok, $not_ok]);
}
$pm->wait_all_children;

ok !$fail, "pass: $pass fail: $fail";

rmtree $tmp;

t/fail.t  view on Meta::CPAN

# this test is borrowed from Archive::Any to secure compatibility

use strict;
use warnings;
use Archive::Any::Lite;
use Test::More tests => 1;

ok( !Archive::Any::Lite->new("im_not_really_a.zip") );



( run in 0.339 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )