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

  1. #!./perl
  2.  
  3. # $RCSfile: multiline.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:20 $
  4.  
  5. print "1..5\n";
  6.  
  7. open(try,'>Comp.try') || (die "Can't open temp file.");
  8.  
  9. $x = 'now is the time
  10. for all good men
  11. to come to.
  12.  
  13.  
  14. !
  15.  
  16. ';
  17.  
  18. $y = 'now is the time' . "\n" .
  19. 'for all good men' . "\n" .
  20. 'to come to.' . "\n\n\n!\n\n";
  21.  
  22. if ($x eq $y) {print "ok 1\n";} else {print "not ok 1\n";}
  23.  
  24. print try $x;
  25. close try;
  26.  
  27. open(try,'Comp.try') || (die "Can't reopen temp file.");
  28. $count = 0;
  29. $z = '';
  30. while (<try>) {
  31.     $z .= $_;
  32.     $count = $count + 1;
  33. }
  34.  
  35. if ($z eq $y) {print "ok 2\n";} else {print "not ok 2\n";}
  36.  
  37. if ($count == 7) {print "ok 3\n";} else {print "not ok 3\n";}
  38.  
  39. $_ = ($^O eq 'MSWin32') ? `type Comp.try` : `cat Comp.try`;
  40.  
  41. if (/.*\n.*\n.*\n$/) {print "ok 4\n";} else {print "not ok 4\n";}
  42.  
  43. close(try) || (die "Can't close temp file.");
  44. unlink 'Comp.try' || `/bin/rm -f Comp.try`;
  45.  
  46. if ($_ eq $y) {print "ok 5\n";} else {print "not ok 5\n";}
  47.