-#!./perl
+#!/usr/bin/perl -w
BEGIN {
- chdir 't' if -d 't';
- @INC = '../lib';
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
}
+chdir 't';
use Test::More tests => 34;
# test FIRSTKEY and NEXTKEY
SKIP: {
$pl->{data}{bar} = 'baz';
- skip('not enough keys to test FIRSTKEY', 2) unless %{ $pl->{data} } > 2;
+ skip('not enough keys to test FIRSTKEY', 2)
+ unless keys %{ $pl->{data} } > 2;
# get the first and second key
my ($first, $second) = keys %{ $pl->{data} };
for (keys %{ $pl->{data} } ) {
last if $i++;
}
-
+
# finally, see if it really can get the first key again
- is( ExtUtils::Packlist::FIRSTKEY($pl), $first,
+ is( ExtUtils::Packlist::FIRSTKEY($pl), $first,
'FIRSTKEY() should be consistent' );
is( ExtUtils::Packlist::NEXTKEY($pl), $second,
chmod 0444, 'eplist';
SKIP: {
- skip("can write readonly files", 1) if -w 'eplist';
+ skip("cannot write readonly files", 1) if -w 'eplist';
eval { ExtUtils::Packlist::write({}, 'eplist') };
like( $@, qr/Can't open file/, 'write() should croak on open failure' );
is( ExtUtils::Packlist::validate($pl), 1,
'validate() should find missing files' );
ExtUtils::Packlist::validate($pl, 1);
- ok( !exists $pl->{data}{fake},
+ ok( !exists $pl->{data}{fake},
'validate() should remove missing files when prompted' );
-
+
# one more new() test, to see if it calls read() successfully
$pl = ExtUtils::Packlist->new('eplist');
}