home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / MacPerl 5.0.3 / Preinstalled MacPerl (FAT) / t / op / pat.t < prev    next >
Encoding:
Text File  |  1994-12-26  |  5.3 KB  |  35 lines  |  [TEXT/McPL]

  1. #!./perl
  2.  
  3. # $RCSfile: pat.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:12 $
  4.  
  5. print "1..60\n";
  6.  
  7. $x = "abc\ndef\n";
  8.  
  9. if ($x =~ /^abc/) {print "ok 1\n";} else {print "not ok 1\n";}
  10. if ($x !~ /^def/) {print "ok 2\n";} else {print "not ok 2\n";}
  11.  
  12. $* = 1;
  13. if ($x =~ /^def/) {print "ok 3\n";} else {print "not ok 3\n";}
  14. $* = 0;
  15.  
  16. $_ = '123';
  17. if (/^([0-9][0-9]*)/) {print "ok 4\n";} else {print "not ok 4\n";}
  18.  
  19. if ($x =~ /^xxx/) {print "not ok 5\n";} else {print "ok 5\n";}
  20. if ($x !~ /^abc/) {print "not ok 6\n";} else {print "ok 6\n";}
  21.  
  22. if ($x =~ /def/) {print "ok 7\n";} else {print "not ok 7\n";}
  23. if ($x !~ /def/) {print "not ok 8\n";} else {print "ok 8\n";}
  24.  
  25. if ($x !~ /.def/) {print "ok 9\n";} else {print "not ok 9\n";}
  26. if ($x =~ /.def/) {print "not ok 10\n";} else {print "ok 10\n";}
  27.  
  28. if ($x =~ /\ndef/) {print "ok 11\n";} else {print "not ok 11\n";}
  29. if ($x !~ /\ndef/) {print "not ok 12\n";} else {print "ok 12\n";}
  30.  
  31. $_ = 'aaabbbccc';
  32. if (/(a*b*)(c*)/ && $1 eq 'aaabbb' && $2 eq 'ccc') {
  33.     print "ok 13\n";
  34. } else {
  35.     print "not