diff options
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | ext/Fcntl/Fcntl.pm | 2 | ||||
-rw-r--r-- | ext/Fcntl/t/autoload.t | 32 |
3 files changed, 34 insertions, 1 deletions
@@ -3162,6 +3162,7 @@ ext/Errno/t/Errno.t See if Errno works ext/Fcntl/Fcntl.pm Fcntl extension Perl module ext/Fcntl/Fcntl.xs Fcntl extension external subroutines ext/Fcntl/Makefile.PL Fcntl extension makefile writer +ext/Fcntl/t/autoload.t See if Fcntl AUTOLOAD error messages work ext/Fcntl/t/fcntl.t See if Fcntl works ext/Fcntl/t/mode.t See if S_ISREG() and S_ISDIR() work ext/Fcntl/t/syslfs.t See if large files work for sysio diff --git a/ext/Fcntl/Fcntl.pm b/ext/Fcntl/Fcntl.pm index 4aede8c222..970735cd4e 100644 --- a/ext/Fcntl/Fcntl.pm +++ b/ext/Fcntl/Fcntl.pm @@ -189,7 +189,7 @@ sub AUTOLOAD { my ($error, $val) = constant($constname); if ($error) { my (undef,$file,$line) = caller; - die "$error at $file line $line.\n"; + die "$error at $file line $line\n"; } no strict 'refs'; *$AUTOLOAD = sub { $val }; diff --git a/ext/Fcntl/t/autoload.t b/ext/Fcntl/t/autoload.t new file mode 100644 index 0000000000..09d089c8ae --- /dev/null +++ b/ext/Fcntl/t/autoload.t @@ -0,0 +1,32 @@ +#!./perl -w + +use strict; +use Test::More; + +require Fcntl; + +# SEEK_SET intentionally included to test the skip functionality. +foreach my $symbol (qw(SEEK_SET O_BINARY S_ENFMT)) { + my $full_name = "Fcntl::$symbol"; + if (defined eval $full_name) { + foreach my $code ($full_name, "$full_name()") { + my $value = eval $code; + like ($value, qr/^[0-9]+$/, "$code is defined on this system"); + } + } else { + foreach my $code ($full_name, "$full_name()") { + my $value = eval $code; + like ($@, + qr/^Your vendor has not defined Fcntl macro $symbol, used at \(eval [0-9]+\) line 1\n\z/, + "Expected error message for $symbol, not defined on this system"); + } + } +} + +my $value = eval 'Fcntl::S_ISPIE()'; +is($value, undef, "Fcntl::S_ISPIE isn't valid"); +like ($@, + qr/^S_ISPIE is not a valid Fcntl macro at \(eval [0-9]+\) line 1\n\z/, + "Expected error message for S_ISPIE"); + +done_testing(); |