}
BEGIN {
- use Test::More tests => 26;
+ use Test::More tests => 34;
use File::Spec;
}
@ARGV = ( $Testfile );
ok( test_f(), 'now creating that file' );
+ is_deeply( \@ARGV, [$Testfile], 'test_f preserves @ARGV' );
@ARGV = ( $Testfile );
ok( -e $ARGV[0], 'created!' );
# change a file to read-write
@ARGV = ( '0600', $Testfile );
+ my @orig_argv = @ARGV;
ExtUtils::Command::chmod();
+ is_deeply( \@ARGV, \@orig_argv, 'chmod preserves @ARGV' );
is( ((stat($Testfile))[2] & 07777) & 0700,
($^O eq 'vos' ? 0700 : 0600), 'change a file to read-write' );
# copy a file to a nested subdirectory
unshift @ARGV, $Testfile;
+ @orig_argv = @ARGV;
cp();
+ is_deeply( \@ARGV, \@orig_argv, 'cp preserves @ARGV' );
ok( -e File::Spec->join( 'ecmddir', 'temp2', $Testfile ), 'copied okay' );
# move a file to a subdirectory
@ARGV = ( $Testfile, 'ecmddir' );
- mv();
+ @orig_argv = @ARGV;
+ ok( mv() );
+ is_deeply( \@ARGV, \@orig_argv, 'mv preserves @ARGV' );
ok( ! -e $Testfile, 'moved file away' );
ok( -e File::Spec->join( 'ecmddir', $Testfile ), 'file in new location' );
ok( ! -e $dir, "removed $dir successfully" );
}
+{
+ mkdir 'd2utest';
+ open(FILE, '>d2utest/foo');
+ print FILE "stuff\015\012and thing\015\012";
+ close FILE;
+
+ open(FILE, '>d2utest/bar');
+ binmode(FILE);
+ my $bin = "\c@\c@\c@\c@\c@\c@\cA\c@\c@\c@\015\012".
+ "\@\c@\cA\c@\c@\c@8__LIN\015\012";
+ print FILE $bin;
+ close FILE;
+
+ local @ARGV = 'd2utest';
+ ExtUtils::Command::dos2unix();
+
+ open(FILE, 'd2utest/foo');
+ is( join('', <FILE>), "stuff\012and thing\012", 'dos2unix' );
+ close FILE;
+
+ open(FILE, 'd2utest/bar');
+ binmode(FILE);
+ ok( -B 'd2utest/bar' );
+ is( join('', <FILE>), $bin, 'dos2unix preserves binaries');
+ close FILE;
+}
+
END {
1 while unlink $Testfile, 'newfile';
File::Path::rmtree( 'ecmddir' );
+ File::Path::rmtree( 'd2utest' );
}