home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / perl-5.003-src.tgz / tar.out / fsf / perl / vms / ext / Stdio / test.pl < prev   
Text File  |  1996-09-28  |  1KB  |  42 lines

  1. # Tests for VMS::Stdio v2.0
  2. use VMS::Stdio;
  3. import VMS::Stdio qw(&flush &getname &rewind &sync);
  4.  
  5. print "1..13\n";
  6. print +(defined(&getname) ? '' : 'not '), "ok 1\n";
  7.  
  8. $name = "test$$";
  9. $name++ while -e "$name.tmp";
  10. $fh = VMS::Stdio::vmsopen("+>$name",'ctx=rec','shr=put','fop=dlt','dna=.tmp');
  11. print +($fh ? '' : 'not '), "ok 2\n";
  12.  
  13. print +(flush($fh) ? '' : 'not '),"ok 3\n";
  14. print +(sync($fh) ? '' : 'not '),"ok 4\n";
  15.  
  16. $time = (stat("$name.tmp"))[9];
  17. print +($time ? '' : 'not '), "ok 5\n";
  18.  
  19. print 'not ' unless print $fh scalar(localtime($time)),"\n";
  20. print "ok 6\n";
  21.  
  22. print +(rewind($fh) ? '' : 'not '),"ok 7\n";
  23.  
  24. chop($line = <$fh>);
  25. print +($line eq localtime($time) ? '' : 'not '), "ok 8\n";
  26.  
  27. ($gotname) = (getname($fh) =~/\](.*);/);
  28. print +($gotname eq "\U$name.tmp" ? '' : 'not '), "ok 9\n";
  29.  
  30. $sfh = VMS::Stdio::vmssysopen($name, O_RDONLY, 0,
  31.                               'ctx=rec', 'shr=put', 'dna=.tmp');
  32. print +($sfh ? '' : 'not ($!) '), "ok 10\n";
  33.  
  34. close($fh);
  35. sysread($sfh,$line,24);
  36. print +($line eq localtime($time) ? '' : 'not '), "ok 11\n";
  37.  
  38. undef $sfh;
  39. print +(stat("$name.tmp") ? 'not ' : ''),"ok 12\n";
  40.  
  41. print +(&VMS::Stdio::tmpnam ? '' : 'not '),"ok 13\n";
  42.