xref: /openbsd-src/gnu/usr.bin/perl/ext/Fcntl/t/autoload.t (revision 898184e3e61f9129feb5978fad5a8c6865f00b92)
1*898184e3Ssthen#!./perl -w
2*898184e3Ssthen
3*898184e3Ssthenuse strict;
4*898184e3Ssthenuse Test::More;
5*898184e3Ssthen
6*898184e3Ssthenrequire Fcntl;
7*898184e3Ssthen
8*898184e3Ssthen# SEEK_SET intentionally included to test the skip functionality.
9*898184e3Ssthenforeach my $symbol (qw(SEEK_SET O_BINARY S_ENFMT)) {
10*898184e3Ssthen    my $full_name = "Fcntl::$symbol";
11*898184e3Ssthen    if (defined eval $full_name) {
12*898184e3Ssthen	foreach my $code ($full_name, "$full_name()") {
13*898184e3Ssthen	    my $value = eval $code;
14*898184e3Ssthen	    like ($value, qr/^[0-9]+$/, "$code is defined on this system");
15*898184e3Ssthen	}
16*898184e3Ssthen    } else {
17*898184e3Ssthen	foreach my $code ($full_name, "$full_name()") {
18*898184e3Ssthen	    my $value = eval $code;
19*898184e3Ssthen	    like ($@,
20*898184e3Ssthen		  qr/^Your vendor has not defined Fcntl macro $symbol, used at \(eval [0-9]+\) line 1\n\z/,
21*898184e3Ssthen		  "Expected error message for $symbol, not defined on this system");
22*898184e3Ssthen	}
23*898184e3Ssthen    }
24*898184e3Ssthen}
25*898184e3Ssthen
26*898184e3Ssthenmy $value = eval 'Fcntl::S_ISPIE()';
27*898184e3Ssthenis($value, undef, "Fcntl::S_ISPIE isn't valid");
28*898184e3Ssthenlike ($@,
29*898184e3Ssthen      qr/^S_ISPIE is not a valid Fcntl macro at \(eval [0-9]+\) line 1\n\z/,
30*898184e3Ssthen      "Expected error message for S_ISPIE");
31*898184e3Ssthen
32*898184e3Ssthendone_testing();
33