~ubuntu-branches/ubuntu/jaunty/horae/jaunty

« back to all changes in this revision

Viewing changes to 0CPAN/Archive-Zip-1.16/t/testTree.t

  • Committer: Bazaar Package Importer
  • Author(s): Carlo Segre
  • Date: 2008-02-23 23:13:02 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080223231302-mnyyxs3icvrus4ke
Tags: 066-3
Apply patch to athena_parts/misc.pl for compatibility with 
perl-tk 804.28.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Test Archive::Zip::Tree module
2
 
# $Revision: 1.6 $
3
 
# Before `make install' is performed this script should be runnable with
4
 
# `make test'. After `make install' it should work as `perl t/testTree.t'
5
 
# vim: ts=4 sw=4 ft=perl
6
 
 
7
 
$^W = 1;
8
 
$| = 1;
9
 
use strict;
10
 
use Test;
11
 
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
12
 
use FileHandle;
13
 
use File::Spec 0.8;
14
 
 
15
 
my $zip;
16
 
my @memberNames;
17
 
 
18
 
sub makeZip
19
 
{
20
 
        my ($src, $dest, $pred) = @_;
21
 
        $zip = Archive::Zip->new();
22
 
        $zip->addTree($src, $dest, $pred);
23
 
        @memberNames = $zip->memberNames();
24
 
}
25
 
 
26
 
sub makeZipAndLookFor
27
 
{
28
 
        my ($src, $dest, $pred, $lookFor) = @_;
29
 
        makeZip($src, $dest, $pred);
30
 
        ok( @memberNames );
31
 
        ok( (grep { $_ eq $lookFor } @memberNames) == 1 )
32
 
                or print STDERR "Can't find $lookFor in (" . join(",", @memberNames) . ")\n";
33
 
}
34
 
 
35
 
BEGIN { plan tests => 6, todo => [] }
36
 
 
37
 
BEGIN { require 't/common.pl' }
38
 
 
39
 
use constant FILENAME => File::Spec->catfile(TESTDIR, 'testing.txt');
40
 
 
41
 
my ($testFileVolume, $testFileDirs, $testFileName) = File::Spec->splitpath($0);
42
 
 
43
 
makeZipAndLookFor('.', '', sub { print "file $_\n"; -f && /\.t$/ }, 't/test.t' );
44
 
makeZipAndLookFor('.', 'e/', sub { -f && /\.t$/ }, 'e/t/test.t');
45
 
makeZipAndLookFor('./t', '', sub { -f && /\.t$/ }, 'test.t' );