Make B::Deparse able to handle pragmas from %^H.
[p5sagit/p5-mst-13.2.git] / ext / Errno / t / Errno.t
1 #!./perl -w
2
3 BEGIN {
4     unless(grep /blib/, @INC) {
5         chdir 't' if -d 't';
6         if ($^O eq 'MacOS') { 
7             @INC = qw(: ::lib ::macos:lib); 
8         } else { 
9             @INC = '../lib'; 
10         }
11     }
12 }
13
14 use Test::More tests => 10;
15
16 BEGIN {
17     use_ok("Errno");
18 }
19
20 BAIL_OUT("No errno's are exported") unless @Errno::EXPORT_OK;
21
22 my $err = $Errno::EXPORT_OK[0];
23 my $num = &{"Errno::$err"};
24
25 is($num, &{"Errno::$err"});
26
27 $! = $num;
28 ok(exists $!{$err});
29
30 $! = 0;
31 ok(! $!{$err});
32
33 ok(join(",",sort keys(%!)) eq join(",",sort @Errno::EXPORT_OK));
34
35 eval { exists $!{[]} };
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}));