home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / t / op / glob.t < prev    next >
Text File  |  1999-10-12  |  896b  |  41 lines

  1. #!./perl
  2.  
  3. BEGIN {
  4.     chdir 't' if -d 't';
  5.     unshift @INC, '../lib';
  6. }
  7.  
  8. print "1..6\n";
  9.  
  10. @oops = @ops = <op/*>;
  11.  
  12. if ($^O eq 'MSWin32') {
  13.   map { $files{lc($_)}++ } <op/*>;
  14.   map { delete $files{"op/$_"} } split /[\s\n]/, `cmd /c "dir /b /l op & dir /b /l /ah op 2>nul"`,
  15. }
  16. else {
  17.   map { $files{$_}++ } <op/*>;
  18.   map { delete $files{$_} } split /[\s\n]/, `echo op/*`;
  19. }
  20. if (keys %files) {
  21.     print "not ok 1\t(",join(' ', sort keys %files),"\n";
  22. } else { print "ok 1\n"; }
  23.  
  24. print $/ eq "\n" ? "ok 2\n" : "not ok 2\n";
  25.  
  26. while (<jskdfjskdfj* op/* jskdjfjkosvk*>) {
  27.     $not = "not " unless $_ eq shift @ops;
  28.     $not = "not at all " if $/ eq "\0";
  29. }
  30. print "${not}ok 3\n";
  31.  
  32. print $/ eq "\n" ? "ok 4\n" : "not ok 4\n";
  33.  
  34. # test the "glob" operator
  35. $_ = "op/*";
  36. @glops = glob $_;
  37. print "@glops" eq "@oops" ? "ok 5\n" : "not ok 5\n";
  38.  
  39. @glops = glob;
  40. print "@glops" eq "@oops" ? "ok 6\n" : "not ok 6\n";
  41.