This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Add error check
[perl5.git] / lib / diagnostics.t
index d9855a9..ee0c160 100644 (file)
@@ -1,16 +1,11 @@
 #!./perl
 
 BEGIN {
-    if ($^O eq 'MacOS') {
-       chdir '::' if -d '::pod' && -d '::t';
-       @INC = ':lib:';
-    } else {
-       chdir '..' if -d '../pod' && -d '../t';
-       @INC = 'lib';
-    }
+    chdir '..' if -d '../pod' && -d '../t';
+    @INC = 'lib';
 }
 
-use Test::More tests => 2;
+use Test::More tests => 3;
 
 BEGIN { use_ok('diagnostics') }
 
@@ -21,3 +16,10 @@ eval {
 };
 
 like( $@, qr/^Base class package "I::do::not::exist" is empty/);
+
+# Test for %.0f patterns in perldiag, added in 5.11.0
+close STDERR;
+open STDERR, ">", \my $warning
+    or die "Couldn't redirect STDERR to var: $!";
+warn('gmtime(nan) too large');
+like $warning, qr/\(W overflow\) You called/, '%0.f patterns';