stat.t: Make test for -T _ and lstat more robust
authorFather Chrysostomos <sprout@cpan.org>
Sat, 14 Jan 2012 20:59:34 +0000 (12:59 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 14 Jan 2012 22:16:26 +0000 (14:16 -0800)
It is now less likely to fail if one runs stat.t manually when tests
are running, due to the random file name.  It also works now when the
script chdirs (when run outside t), because it no longer relies on $0
being a real file.

That last part was broken by commit ad2d99e39, which made -T _ more
consistent when it cannot open the file.  It used to set the stat
type, but not the success status (as of commit 25988e07, which
fixed #4253).

t/op/stat.t

index dfc00b9..3e99865 100644 (file)
@@ -471,8 +471,8 @@ SKIP: {
 
     # bug id 20020124.004
     # If we have d_lstat, we should have symlink()
-    my $linkname = 'dolzero';
-    symlink $0, $linkname or die "# Can't symlink $0: $!";
+    my $linkname = 'stat-' . rand =~ y/.//cdr;
+    symlink $Perl, $linkname or die "# Can't symlink $0: $!";
     lstat $linkname;
     -T _;
     eval { lstat _ };