This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
POSIX: t/posix.t: avoid warning
authorDavid Mitchell <davem@iabyn.com>
Tue, 1 Dec 2020 16:33:07 +0000 (16:33 +0000)
committerDavid Mitchell <davem@iabyn.com>
Tue, 1 Dec 2020 16:33:07 +0000 (16:33 +0000)
Since warnings were enabled in this test file, skip one spurious warning
being generated. S_ISBLK() is being called purely to test run-time
loading; so it's being called without an arg, which now triggers an
'uninitialized value' warning.

ext/POSIX/t/posix.t

index 5024937..60ef36d 100644 (file)
@@ -351,7 +351,12 @@ is ($result, undef, "fgets should fail");
 like ($@, qr/^Unimplemented: POSIX::fgets\(\): Use method IO::Handle::gets\(\) instead/,
       "check its redef message");
 
-eval { use strict; POSIX->import("S_ISBLK"); my $x = S_ISBLK };
+eval {
+    use strict;
+    no warnings 'uninitialized'; # S_ISBLK normally has an arg
+    POSIX->import("S_ISBLK");
+    my $x = S_ISBLK
+};
 unlike( $@, qr/Can't use string .* as a symbol ref/, "Can import autoloaded constants" );
 
 SKIP: {