This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
error messages vary between platforms, use errno values instead
authorTony Cook <tony@develop-help.com>
Wed, 30 Mar 2016 23:40:25 +0000 (10:40 +1100)
committerRicardo Signes <rjbs@cpan.org>
Thu, 7 Apr 2016 11:45:09 +0000 (07:45 -0400)
t/op/stat.t

index c388083..637a902 100644 (file)
@@ -637,12 +637,19 @@ is join("-", 1,2,3,(stat stat stat),4,5,6), "1-2-3-4-5-6",
   'stat inside stat gets scalar context';
 
 # [perl #126162] stat an array should not work
+my $Errno_loaded = eval { require Errno };
 my $statfile = './op/stat.t';
 my @statarg = ($statfile, $statfile);
 ok !stat(@statarg),
   'stat on an array of valid paths should warn and should not return any data';
-is $!, 'No such file or directory',
-  'stat on an array of valid paths should return "No such file or directory"';
+my $error = 0+$!;
+SKIP:
+{
+    skip "Errno not available", 1
+      unless $Errno_loaded;
+    is $error, &Errno::ENOENT,
+      'stat on an array of valid paths should return ENOENT';
+}
 
 END {
     chmod 0666, $tmpfile;