diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-10-19 12:34:20 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-10-19 12:34:20 +0200 |
commit | 228f83bf2f4cc0f605478d266ed3a2dd48cb7041 (patch) | |
tree | 3f42bb4f81cf41f6bec31649bcbd05ccc2b74a49 /ext/Fcntl/t | |
parent | 80a649c810fab9a1510e35c012adc454dd4a0a4e (diff) | |
download | perl-228f83bf2f4cc0f605478d266ed3a2dd48cb7041.tar.gz |
Make Fcntl::AUTOLOAD's error messages consistent with croak() using modules.
Fcntl avoids using Carp::croak(), but its code was adding a full stop at the
end of all error messages. Other modules are using croak(), which has no full
stop between the line number and the newline.
Add a test for the error messages from Fcntl::AUTOLOAD.
Diffstat (limited to 'ext/Fcntl/t')
-rw-r--r-- | ext/Fcntl/t/autoload.t | 32 |
1 files changed, 32 insertions, 0 deletions
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(); |