Make B::Deparse able to handle pragmas from %^H.
[p5sagit/p5-mst-13.2.git] / ext / Errno / t / Errno.t
CommitLineData
eb0f98c9 1#!./perl -w
eab60bb1 2
3BEGIN {
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 14use Test::More tests => 10;
eab60bb1 15
eb0f98c9 16BEGIN {
17 use_ok("Errno");
18}
eab60bb1 19
eb0f98c9 20BAIL_OUT("No errno's are exported") unless @Errno::EXPORT_OK;
eab60bb1 21
eb0f98c9 22my $err = $Errno::EXPORT_OK[0];
23my $num = &{"Errno::$err"};
eab60bb1 24
eb0f98c9 25is($num, &{"Errno::$err"});
eab60bb1 26
27$! = $num;
eb0f98c9 28ok(exists $!{$err});
eab60bb1 29
30$! = 0;
eb0f98c9 31ok(! $!{$err});
3d64f815 32
eb0f98c9 33ok(join(",",sort keys(%!)) eq join(",",sort @Errno::EXPORT_OK));
f8ed3476 34
35eval { exists $!{[]} };
eb0f98c9 36ok(! $@);
37
38eval {$!{$err} = "qunckkk" };
39like($@, qr/^ERRNO hash is read only!/);
40
41eval {delete $!{$err}};
42like($@, 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
46is($!{EFLRBBB}, "");
47ok(! exists($!{EFLRBBB}));