Adjust test count for non-windows machines
[p5sagit/p5-mst-13.2.git] / ext / Errno / t / Errno.t
1 #!./perl
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 Errno;
15
16 print "1..6\n";
17
18 print "not " unless @Errno::EXPORT_OK;
19 print "ok 1\n";
20 die unless @Errno::EXPORT_OK;
21
22 $err = $Errno::EXPORT_OK[0];
23 $num = &{"Errno::$err"};
24
25 print "not " unless &{"Errno::$err"} == $num;
26 print "ok 2\n";
27
28 $! = $num;
29 # Some systems have ESUCCESS 0, that's why exists instead of boolean.
30 print "not " unless exists $!{$err};
31 print "ok 3\n";
32
33 $! = 0;
34 print "not " if $!{$err};
35 print "ok 4\n";
36
37 $s1 = join(",",sort keys(%!));
38 $s2 = join(",",sort @Errno::EXPORT_OK);
39
40 if($s1 ne $s2) {
41     my @s1 = keys(%!);
42     my @s2 = @Errno::EXPORT_OK;
43     my(%s1,%s2);
44     @s1{@s1} = ();
45     @s2{@s2} = ();
46     delete @s2{@s1};
47     delete @s1{@s2};
48     print "# These are only in \%!\n";
49     print "# ",join(" ",map { "'$_'" } keys %s1),"\n";
50     print "# These are only in \@EXPORT_OK\n";
51     print "# ",join(" ",map { "'$_'" } keys %s2),"\n";
52     print "not ";
53 }
54
55 print "ok 5\n";
56
57 eval { exists $!{[]} };
58 print $@ ? "not ok 6\n" : "ok 6\n";