This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update JSON-PP to CPAN version 2.27300
[perl5.git] / ext / Fcntl / t / autoload.t
1 #!./perl -w
2
3 use strict;
4 use Test::More;
5
6 require Fcntl;
7
8 # SEEK_SET intentionally included to test the skip functionality.
9 foreach my $symbol (qw(SEEK_SET O_BINARY S_ENFMT)) {
10     my $full_name = "Fcntl::$symbol";
11     if (defined eval $full_name) {
12         foreach my $code ($full_name, "$full_name()") {
13             my $value = eval $code;
14             like ($value, qr/^[0-9]+$/, "$code is defined on this system");
15         }
16     } else {
17         foreach my $code ($full_name, "$full_name()") {
18             my $value = eval $code;
19             like ($@,
20                   qr/^Your vendor has not defined Fcntl macro $symbol, used at \(eval [0-9]+\) line 1\n\z/,
21                   "Expected error message for $symbol, not defined on this system");
22         }
23     }
24 }
25
26 my $value = eval 'Fcntl::S_ISPIE()';
27 is($value, undef, "Fcntl::S_ISPIE isn't valid");
28 like ($@,
29       qr/^S_ISPIE is not a valid Fcntl macro at \(eval [0-9]+\) line 1\n\z/,
30       "Expected error message for S_ISPIE");
31
32 done_testing();