home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / t / lib / errno.t < prev    next >
Text File  |  1999-07-20  |  937b  |  51 lines

  1. #!./perl
  2.  
  3. BEGIN {
  4.     unless(grep /blib/, @INC) {
  5.     chdir 't' if -d 't';
  6.     unshift @INC, '../lib' if -d '../lib';
  7.     }
  8. }
  9.  
  10. use Errno;
  11.  
  12. print "1..5\n";
  13.  
  14. print "not " unless @Errno::EXPORT_OK;
  15. print "ok 1\n";
  16. die unless @Errno::EXPORT_OK;
  17.  
  18. $err = $Errno::EXPORT_OK[0];
  19. $num = &{"Errno::$err"};
  20.  
  21. print "not " unless &{"Errno::$err"} == $num;
  22. print "ok 2\n";
  23.  
  24. $! = $num;
  25. print "not " unless $!{$err};
  26. print "ok 3\n";
  27.  
  28. $! = 0;
  29. print "not " if $!{$err};
  30. print "ok 4\n";
  31.  
  32. $s1 = join(",",sort keys(%!));
  33. $s2 = join(",",sort @Errno::EXPORT_OK);
  34.  
  35. if($s1 ne $s2) {
  36.     my @s1 = keys(%!);
  37.     my @s2 = @Errno::EXPORT_OK;
  38.     my(%s1,%s2);
  39.     @s1{@s1} = ();
  40.     @s2{@s2} = ();
  41.     delete @s2{@s1};
  42.     delete @s1{@s2};
  43.     print "# These are only in \%!\n";
  44.     print "# ",join(" ",map { "'$_'" } keys %s1),"\n";
  45.     print "# These are only in \@EXPORT_OK\n";
  46.     print "# ",join(" ",map { "'$_'" } keys %s2),"\n";
  47.     print "not ";
  48. }
  49.  
  50. print "ok 5\n";
  51.