diff options
Diffstat (limited to 'lib/ExtUtils/t/Command.t')
-rw-r--r-- | lib/ExtUtils/t/Command.t | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/lib/ExtUtils/t/Command.t b/lib/ExtUtils/t/Command.t index bf7d177889..943296c079 100644 --- a/lib/ExtUtils/t/Command.t +++ b/lib/ExtUtils/t/Command.t @@ -23,7 +23,7 @@ BEGIN { } BEGIN { - use Test::More tests => 26; + use Test::More tests => 34; use File::Spec; } @@ -66,6 +66,7 @@ BEGIN { @ARGV = ( $Testfile ); ok( test_f(), 'now creating that file' ); + is_deeply( \@ARGV, [$Testfile], 'test_f preserves @ARGV' ); @ARGV = ( $Testfile ); ok( -e $ARGV[0], 'created!' ); @@ -134,7 +135,9 @@ BEGIN { # 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' ); @@ -148,7 +151,9 @@ BEGIN { # 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' ); @@ -160,7 +165,9 @@ BEGIN { # 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' ); @@ -208,7 +215,35 @@ BEGIN { 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' ); } |