File: autoload.t

package info (click to toggle)
perl 5.42.0-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 128,392 kB
  • sloc: perl: 534,963; ansic: 240,563; sh: 72,042; pascal: 6,934; xml: 2,428; yacc: 1,360; makefile: 1,197; cpp: 208; lisp: 1
file content (32 lines) | stat: -rw-r--r-- 918 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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();