xref: /openbsd/gnu/usr.bin/perl/ext/Errno/t/Errno.t (revision 891d7ab6)
1#!./perl -w
2
3use Test::More tests => 10;
4
5BEGIN {
6    use_ok("Errno");
7}
8
9BAIL_OUT("No errno's are exported") unless @Errno::EXPORT_OK;
10
11my $err = $Errno::EXPORT_OK[0];
12my $num = &{"Errno::$err"};
13
14is($num, &{"Errno::$err"});
15
16$! = $num;
17ok(exists $!{$err});
18
19$! = 0;
20ok(! $!{$err});
21
22ok(join(",",sort keys(%!)) eq join(",",sort @Errno::EXPORT_OK));
23
24eval { exists $!{[]} };
25ok(! $@);
26
27eval {$!{$err} = "qunckkk" };
28like($@, qr/^ERRNO hash is read only!/);
29
30eval {delete $!{$err}};
31like($@, 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
35is($!{EFLRBBB}, "");
36ok(! exists($!{EFLRBBB}));
37