This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
302bd8ddd6905817bac7292d9cd68b4ff208155b
[perl5.git] / ext / Errno / t / Errno.t
1 #!./perl -w
2
3 use Test::More tests => 10;
4
5 BEGIN {
6     use_ok("Errno");
7 }
8
9 BAIL_OUT("No errno's are exported") unless @Errno::EXPORT_OK;
10
11 my $err = $Errno::EXPORT_OK[0];
12 my $num = &{"Errno::$err"};
13
14 is($num, &{"Errno::$err"});
15
16 $! = $num;
17 ok(exists $!{$err});
18
19 $! = 0;
20 ok(! $!{$err});
21
22 ok(join(",",sort keys(%!)) eq join(",",sort @Errno::EXPORT_OK));
23
24 eval { exists $!{[]} };
25 ok(! $@);
26
27 eval {$!{$err} = "qunckkk" };
28 like($@, qr/^ERRNO hash is read only!/);
29
30 eval {delete $!{$err}};
31 like($@, qr/^ERRNO hash is read only!/);
32
33 # The following tests are in trouble if some OS picks errno values
34 # through Acme::MetaSyntactic::batman
35 is($!{EFLRBBB}, "");
36 ok(! exists($!{EFLRBBB}));