X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fstat.t;h=70ab5a321c675c3fb3695e11f868bd71d935281f;hb=01b3578752f17209014eae7d693a93093779daac;hp=6afbadc8417a97b78fc650cf4f57c1c2e093fed7;hpb=151269f6b19acf66be4301c6a8ad22acbd4b3c22;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/stat.t b/t/op/stat.t index 6afbadc..70ab5a3 100755 --- a/t/op/stat.t +++ b/t/op/stat.t @@ -9,7 +9,7 @@ BEGIN { use Config; use File::Spec; -plan tests => 78; +plan tests => 82; my $Perl = which_perl(); @@ -406,16 +406,22 @@ unlink $tmpfile or print "# unlink failed: $!\n"; my @r = \stat($Curdir); is(scalar @r, 13, 'stat returns full 13 elements'); +stat $0; +eval { lstat _ }; +like( $@, qr/^The stat preceding lstat\(\) wasn't an lstat/, + 'lstat _ croaks after stat' ); +eval { -l _ }; +like( $@, qr/^The stat preceding -l _ wasn't an lstat/, + '-l _ croaks after stat' ); + +lstat $0; +eval { lstat _ }; +is( "$@", "", "lstat _ ok after lstat" ); +eval { -l _ }; +is( "$@", "", "-l _ ok after lstat" ); + SKIP: { - skip "No lstat", 4 unless $Config{d_lstat}; - - stat $0; - eval { lstat _ }; - like( $@, qr/^The stat preceding lstat\(\) wasn't an lstat/, - 'lstat _ croaks after stat' ); - eval { -l _ }; - like( $@, qr/^The stat preceding -l _ wasn't an lstat/, - '-l _ croaks after stat' ); + skip "No lstat", 2 unless $Config{d_lstat}; # bug id 20020124.004 # If we have d_lstat, we should have symlink() @@ -447,6 +453,18 @@ ok( (-A _) < 0, 'negative -A works'); ok( (-C _) < 0, 'negative -C works'); ok(unlink($f), 'unlink tmp file'); +{ + ok(open(F, ">", $tmpfile), 'can create temp file'); + close F; + chmod 0077, $tmpfile; + my @a = stat($tmpfile); + my $s1 = -s _; + -T _; + my $s2 = -s _; + is($s1, $s2, q(-T _ doesn't break the statbuffer)); + unlink $file; +} + END { 1 while unlink $tmpfile; }