Commit | Line | Data |
---|---|---|
eb0f98c9 | 1 | #!./perl -w |
eab60bb1 | 2 | |
3 | BEGIN { | |
4 | unless(grep /blib/, @INC) { | |
5 | chdir 't' if -d 't'; | |
db5fd395 | 6 | if ($^O eq 'MacOS') { |
7 | @INC = qw(: ::lib ::macos:lib); | |
8 | } else { | |
9 | @INC = '../lib'; | |
10 | } | |
eab60bb1 | 11 | } |
12 | } | |
13 | ||
eb0f98c9 | 14 | use Test::More tests => 10; |
eab60bb1 | 15 | |
eb0f98c9 | 16 | BEGIN { |
17 | use_ok("Errno"); | |
18 | } | |
eab60bb1 | 19 | |
eb0f98c9 | 20 | BAIL_OUT("No errno's are exported") unless @Errno::EXPORT_OK; |
eab60bb1 | 21 | |
eb0f98c9 | 22 | my $err = $Errno::EXPORT_OK[0]; |
23 | my $num = &{"Errno::$err"}; | |
eab60bb1 | 24 | |
eb0f98c9 | 25 | is($num, &{"Errno::$err"}); |
eab60bb1 | 26 | |
27 | $! = $num; | |
eb0f98c9 | 28 | ok(exists $!{$err}); |
eab60bb1 | 29 | |
30 | $! = 0; | |
eb0f98c9 | 31 | ok(! $!{$err}); |
3d64f815 | 32 | |
eb0f98c9 | 33 | ok(join(",",sort keys(%!)) eq join(",",sort @Errno::EXPORT_OK)); |
f8ed3476 | 34 | |
35 | eval { exists $!{[]} }; | |
eb0f98c9 | 36 | ok(! $@); |
37 | ||
38 | eval {$!{$err} = "qunckkk" }; | |
39 | like($@, qr/^ERRNO hash is read only!/); | |
40 | ||
41 | eval {delete $!{$err}}; | |
42 | like($@, qr/^ERRNO hash is read only!/); | |
43 | ||
44 | # The following tests are in trouble if some OS picks errno values | |
45 | # through Acme::MetaSyntactic::batman | |
46 | is($!{EFLRBBB}, ""); | |
47 | ok(! exists($!{EFLRBBB})); |