In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/61a7d4fdb04e98c5b2c76e1a5b406b5395fae945?hp=5c4676374bfdffb3a8e1176a5cd9e0b1effcc2f5>
- Log ----------------------------------------------------------------- commit 61a7d4fdb04e98c5b2c76e1a5b406b5395fae945 Author: Josh ben Jore <[email protected]> Date: Fri Jul 31 22:36:17 2009 -0700 Pre-resolve symlink for File::Stat test under -Dmksymlinks ----------------------------------------------------------------------- Summary of changes: lib/File/stat.t | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/File/stat.t b/lib/File/stat.t index b53c9e9..f104b74 100644 --- a/lib/File/stat.t +++ b/lib/File/stat.t @@ -6,24 +6,37 @@ BEGIN { } use Test::More; +use Config qw( %Config ); BEGIN { + # Check whether the build is configured with -Dmksymlinks + our $Dmksymlinks = + grep { /^config_arg\d+$/ && $Config{$_} eq '-Dmksymlinks' } + keys %Config; + + # Resolve symlink to ./TEST if this build is configured with -Dmksymlinks + our $file = 'TEST'; + if ( $Dmksymlinks ) { + $file = readlink $file; + die "Can't readlink(TEST): $!" if ! defined $file; + } + our $hasst; - eval { my @n = stat "TEST" }; + eval { my @n = stat $file }; $hasst = 1 unless $@ && $@ =~ /unimplemented/; unless ($hasst) { plan skip_all => "no stat"; exit 0 } use Config; $hasst = 0 unless $Config{'i_sysstat'} eq 'define'; unless ($hasst) { plan skip_all => "no sys/stat.h"; exit 0 } - our @stat = stat "TEST"; # This is the function stat. - unless (@stat) { plan skip_all => "1..0 # Skip: no file TEST"; exit 0 } + our @stat = stat $file; # This is the function stat. + unless (@stat) { plan skip_all => "1..0 # Skip: no file $file"; exit 0 } } plan tests => 19 + 24*2 + 3; use_ok( 'File::stat' ); -my $stat = File::stat::stat( "TEST" ); # This is the OO stat. +my $stat = File::stat::stat( $file ); # This is the OO stat. ok( ref($stat), 'should build a stat object' ); is( $stat->dev, $stat[0], "device number in position 0" ); @@ -64,7 +77,7 @@ for (split //, "rwxoRWXOezsfdlpSbcugkMCA") { my $rv = eval "-$_ \$stat"; ok( !$@, "-$_ overload succeeds" ) or diag( $@ ); - is( $rv, eval "-$_ 'TEST'", "correct -$_ overload" ); + is( $rv, eval "-$_ \$file", "correct -$_ overload" ); } } @@ -75,7 +88,7 @@ for (split //, "tTB") { SKIP: { local *STAT; - skip("Could not open file: $!", 2) unless open(STAT, 'TEST'); + skip("Could not open file: $!", 2) unless open(STAT, $file); ok( File::stat::stat('STAT'), '... should be able to find filehandle' ); package foo; -- Perl5 Master Repository
