home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / t / io / tell.t < prev   
Text File  |  2000-01-22  |  2KB  |  85 lines

  1. #!./perl
  2.  
  3. # $RCSfile: tell.t,v $$Revision$$Date$
  4.  
  5. print "1..21\n";
  6.  
  7. $TST = 'tst';
  8.  
  9. $Is_Dosish = ($^O eq 'MSWin32' or $^O eq 'dos' or
  10.           $^O eq 'os2' or $^O eq 'mint' or $^O eq 'cygwin');
  11.  
  12. open($TST, '../Configure') || (die "Can't open ../Configure");
  13. binmode $TST if $Is_Dosish;
  14. if (eof(tst)) { print "not ok 1\n"; } else { print "ok 1\n"; }
  15.  
  16. $firstline = <$TST>;
  17. $secondpos = tell;
  18.  
  19. $x = 0;
  20. while (<tst>) {
  21.     if (eof) {$x++;}
  22. }
  23. if ($x == 1) { print "ok 2\n"; } else { print "not ok 2\n"; }
  24.  
  25. $lastpos = tell;
  26.  
  27. unless (eof) { print "not ok 3\n"; } else { print "ok 3\n"; }
  28.  
  29. if (seek($TST,0,0)) { print "ok 4\n"; } else { print "not ok 4\n"; }
  30.  
  31. if (eof) { print "not ok 5\n"; } else { print "ok 5\n"; }
  32.  
  33. if ($firstline eq <tst>) { print "ok 6\n"; } else { print "not ok 6\n"; }
  34.  
  35. if ($secondpos == tell) { print "ok 7\n"; } else { print "not ok 7\n"; }
  36.  
  37. if (seek(tst,0,1)) { print "ok 8\n"; } else { print "not ok 8\n"; }
  38.  
  39. if (eof($TST)) { print "not ok 9\n"; } else { print "ok 9\n"; }
  40.  
  41. if ($secondpos == tell) { print "ok 10\n"; } else { print "not ok 10\n"; }
  42.  
  43. if (seek(tst,0,2)) { print "ok 11\n"; } else { print "not ok 11\n"; }
  44.  
  45. if ($lastpos == tell) { print "ok 12\n"; } else { print "not ok 12\n"; }
  46.  
  47. unless (eof) { print "not ok 13\n"; } else { print "ok 13\n"; }
  48.  
  49. if ($. == 0) { print "not ok 14\n"; } else { print "ok 14\n"; }
  50.  
  51. $curline = $.;
  52. open(other, '../Configure') || (die "Can't open ../Configure");
  53. binmode other if $^O eq 'MSWin32';
  54.  
  55. {
  56.     local($.);
  57.  
  58.     if ($. == 0) { print "not ok 15\n"; } else { print "ok 15\n"; }
  59.  
  60.     tell other;
  61.     if ($. == 0) { print "ok 16\n"; } else { print "not ok 16\n"; }
  62.  
  63.     $. = 5;
  64.     scalar <other>;
  65.     if ($. == 6) { print "ok 17\n"; } else { print "not ok 17\n"; }
  66. }
  67.  
  68. if ($. == $curline) { print "ok 18\n"; } else { print "not ok 18\n"; }
  69.  
  70. {
  71.     local($.);
  72.  
  73.     scalar <other>;
  74.     if ($. == 7) { print "ok 19\n"; } else { print "not ok 19\n"; }
  75. }
  76.  
  77. if ($. == $curline) { print "ok 20\n"; } else { print "not ok 20\n"; }
  78.  
  79. {
  80.     local($.);
  81.  
  82.     tell other;
  83.     if ($. == 7) { print "ok 21\n"; } else { print "not ok 21\n"; }
  84. }
  85.