From: Rafael Garcia-Suarez Date: Tue, 19 Dec 2006 10:50:13 +0000 (+0000) Subject: Add a regression test to verify that POSIX::AUTOLOAD works, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2ae48df0f018213e8336ab227bb84aba249da141;p=p5sagit%2Fp5-mst-13.2.git Add a regression test to verify that POSIX::AUTOLOAD works, and silence a potential warning from it. p4raw-id: //depot/perl@29592 --- diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm index 6ccfa82..3813e97 100644 --- a/ext/POSIX/POSIX.pm +++ b/ext/POSIX/POSIX.pm @@ -38,6 +38,7 @@ my %NON_CONSTS = (map {($_,1)} sub AUTOLOAD { no strict; + no warnings 'uninitialized'; if ($AUTOLOAD =~ /::(_?[a-z])/) { # require AutoLoader; $AutoLoader::AUTOLOAD = $AUTOLOAD; diff --git a/ext/POSIX/t/posix.t b/ext/POSIX/t/posix.t index 8022fc1..40fee23 100644 --- a/ext/POSIX/t/posix.t +++ b/ext/POSIX/t/posix.t @@ -11,7 +11,7 @@ BEGIN { } BEGIN { require "./test.pl"; } -plan(tests => 65); +plan(tests => 66); use POSIX qw(fcntl_h signal_h limits_h _exit getcwd open read strftime write errno); @@ -271,6 +271,9 @@ ok( POSIX::isalnum(undef),'isalnum undef' ); # those functions should stringify their arguments ok(!POSIX::isalpha([]), 'isalpha []' ); ok( POSIX::isprint([]), 'isprint []' ); + +eval { use strict; POSIX->import("S_ISBLK"); my $x = S_ISBLK }; +unlike( $@, qr/Can't use string .* as a symbol ref/, "Can import autoloaded constants" ); # Check that output is not flushed by _exit. This test should be last # in the file, and is not counted in the total number of tests.