X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FExtUtils%2FCommand.t;h=3a25bffe4bb1be182ea0d27622f6c4a7f303fa22;hb=8c7f0036c6170bb0e341d84874bdb51f472a6afb;hp=7fdaf2d12bd9682a251c77af322fc11864bfa582;hpb=b488a12ac54deb9ec217f73be9be18fed8783973;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/ExtUtils/Command.t b/lib/ExtUtils/Command.t index 7fdaf2d..3a25bff 100644 --- a/lib/ExtUtils/Command.t +++ b/lib/ExtUtils/Command.t @@ -3,19 +3,21 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; +} + +BEGIN { 1 while unlink 'ecmdfile'; # forcibly remove ecmddir/temp2, but don't import mkpath use File::Path (); File::Path::rmtree( 'ecmddir' ); } -use Test::More tests => 21; -use File::Spec; - -SKIP: { - skip( 'ExtUtils::Command is a Win32 module', 21 ) - unless $^O =~ /Win32/; +BEGIN { + use Test::More tests => 21; + use File::Spec; +} +{ use vars qw( *CORE::GLOBAL::exit ); # bad neighbor, but test_f() uses exit() @@ -29,6 +31,7 @@ SKIP: { local *DIR; opendir(DIR, File::Spec->curdir()); while ($file = readdir(DIR)) { + $file =~ s/\.\z// if $^O eq 'VMS'; last if $file =~ /^\w/; } } @@ -49,7 +52,15 @@ SKIP: { # concatenate this file with itself # be extra careful the regex doesn't match itself my $out = tie *STDOUT, 'TieOut'; - @ARGV = ($0, $0); + my $self = $0; + unless (-f $self) { + my ($vol, $dirs, $file) = File::Spec->splitpath($self); + my @dirs = File::Spec->splitdir($dirs); + unshift(@dirs, File::Spec->updir); + $dirs = File::Spec->catdir(@dirs); + $self = File::Spec->catpath($vol, $dirs, $file); + } + @ARGV = ($self, $self); cat(); is( scalar( $$out =~ s/use_ok\( 'ExtUtils::Command'//g), 2, @@ -64,7 +75,6 @@ SKIP: { # these are destructive, have to keep setting @ARGV @ARGV = ( 'ecmdfile' ); - my $now = time; touch(); @ARGV = ( 'ecmdfile' ); @@ -73,6 +83,9 @@ SKIP: { @ARGV = ( 'ecmdfile' ); ok( -e $ARGV[0], 'created!' ); + my ($now) = time; + utime ($now, $now, $ARGV[0]); + # Just checking modify time stamp, access time stamp is set # to the beginning of the day in Win95 is( (stat($ARGV[0]))[9], $now, 'checking modify time stamp' ); @@ -81,7 +94,7 @@ SKIP: { @ARGV = ( 0600, 'ecmdfile' ); ExtUtils::Command::chmod(); - is( (stat('ecmdfile'))[2] & 07777, 0600, 'removed non-owner permissions' ); + is( ((stat('ecmdfile'))[2] & 07777) & 0700, 0600, 'change a file to read-only' ); # mkpath @ARGV = ( File::Spec->join( 'ecmddir', 'temp2' ) );