summaryrefslogtreecommitdiff
path: root/t/op/stat.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-01-13 16:43:30 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-01-13 21:24:54 -0800
commit020cc77c5665898032456aabfe6ae45ccf11f874 (patch)
treee93d463ca6e1eba1190af1226e89ed7a045d7b86 /t/op/stat.t
parent97c226b87fecccdf4a4af5defd1836198a9666e5 (diff)
downloadperl-020cc77c5665898032456aabfe6ae45ccf11f874.tar.gz
stat $ioref should reset the internal stat type
In addition to a stat buffer, Perl keeps track internally of which type of stat was done last, either stat or lstat, so that lstat _ can die if the previous type was stat. This was not being reset for stat $ioref. Filetest ops were fine.
Diffstat (limited to 't/op/stat.t')
-rw-r--r--t/op/stat.t11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/op/stat.t b/t/op/stat.t
index fccadbaaef..d2ce8d14f7 100644
--- a/t/op/stat.t
+++ b/t/op/stat.t
@@ -20,7 +20,7 @@ if(eval {require File::Spec; 1}) {
}
-plan tests => 109;
+plan tests => 110;
my $Perl = which_perl();
@@ -456,6 +456,15 @@ eval { lstat _ };
is( "$@", "", "lstat _ ok after lstat" );
eval { -l _ };
is( "$@", "", "-l _ ok after lstat" );
+
+lstat "test.pl";
+{
+ open my $fh, "test.pl";
+ stat *$fh{IO};
+ eval { lstat _ }
+}
+like $@, qr/^The stat preceding lstat\(\) wasn't an lstat at /,
+'stat $ioref resets stat type';
SKIP: {
skip "No lstat", 2 unless $Config{d_lstat};