}
BEGIN {
- use Test::More tests => 34;
+ use Test::More tests => 38;
use File::Spec;
}
ok( test_f(), 'testing non-existent file' );
@ARGV = ( $Testfile );
- cmp_ok( ! test_f(), '==', (-f $Testfile), 'testing non-existent file' );
+ cmp_ok( ! test_f(), '==', defined (-f $Testfile), 'testing non-existent file' );
# these are destructive, have to keep setting @ARGV
@ARGV = ( $Testfile );
is( ((stat($Testfile))[2] & 07777) & 0700,
($^O eq 'vos' ? 0700 : 0600), 'change a file to read-write' );
+
+ SKIP: {
+ if ($^O eq 'amigaos' || $^O eq 'os2' || $^O eq 'MSWin32' ||
+ $^O eq 'NetWare' || $^O eq 'dos' || $^O eq 'cygwin' ||
+ $^O eq 'MacOS'
+ ) {
+ skip( "different file permission semantics on $^O", 4);
+ }
+
+ @ARGV = ('testdir');
+ mkpath;
+ ok( -e 'testdir' );
+
+ # change a dir to execute-only
+ @ARGV = ( '0100', 'testdir' );
+ ExtUtils::Command::chmod();
+
+ is( ((stat('testdir'))[2] & 07777) & 0700,
+ 0100, 'change a dir to execute-only' );
+
+ # change a dir to read-only
+ @ARGV = ( '0400', 'testdir' );
+ ExtUtils::Command::chmod();
+
+ is( ((stat('testdir'))[2] & 07777) & 0700,
+ ($^O eq 'vos' ? 0500 : 0400), 'change a dir to read-only' );
+
+ # change a dir to write-only
+ @ARGV = ( '0200', 'testdir' );
+ ExtUtils::Command::chmod();
+
+ is( ((stat('testdir'))[2] & 07777) & 0700,
+ ($^O eq 'vos' ? 0700 : 0200), 'change a dir to write-only' );
+
+ @ARGV = ('testdir');
+ rm_rf;
+ }
+
+
# mkpath
@ARGV = ( File::Spec->join( 'ecmddir', 'temp2' ) );
ok( ! -e $ARGV[0], 'temp directory not there yet' );
}
{
- mkdir 'd2utest';
+ { local @ARGV = 'd2utest'; mkpath; }
open(FILE, '>d2utest/foo');
print FILE "stuff\015\012and thing\015\012";
close FILE;