blob: 16d5cb0de97fb155c66cc54ef77121a095c205ff (
plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!./perl -w
BEGIN {
unless(grep /blib/, @INC) {
chdir 't' if -d 't';
if ($^O eq 'MacOS') {
@INC = qw(: ::lib ::macos:lib);
} else {
@INC = '../lib';
}
}
}
use Test::More tests => 10;
BEGIN {
use_ok("Errno");
}
BAIL_OUT("No errno's are exported") unless @Errno::EXPORT_OK;
my $err = $Errno::EXPORT_OK[0];
my $num = &{"Errno::$err"};
is($num, &{"Errno::$err"});
$! = $num;
ok(exists $!{$err});
$! = 0;
ok(! $!{$err});
ok(join(",",sort keys(%!)) eq join(",",sort @Errno::EXPORT_OK));
eval { exists $!{[]} };
ok(! $@);
eval {$!{$err} = "qunckkk" };
like($@, qr/^ERRNO hash is read only!/);
eval {delete $!{$err}};
like($@, qr/^ERRNO hash is read only!/);
# The following tests are in trouble if some OS picks errno values
# through Acme::MetaSyntactic::batman
is($!{EFLRBBB}, "");
ok(! exists($!{EFLRBBB}));
|