diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1996-02-28 03:05:04 +0000 |
---|---|---|
committer | Charles Bailey <bailey@genetics.upenn.edu> | 1996-02-28 03:05:04 +0000 |
commit | 17421385ce15ac9858d575faf7f1b6625a706f1f (patch) | |
tree | 55686893d74c2d6b979b49f009c7832470e246f6 /vms/ext | |
parent | 2ae00b683f65d9797cb0daea56ab5e314b280e49 (diff) | |
download | perl-17421385ce15ac9858d575faf7f1b6625a706f1f.tar.gz |
Add tests for VMS::Stdio
Diffstat (limited to 'vms/ext')
-rw-r--r-- | vms/ext/Stdio/test.pl | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/vms/ext/Stdio/test.pl b/vms/ext/Stdio/test.pl new file mode 100644 index 0000000000..12e508aa1f --- /dev/null +++ b/vms/ext/Stdio/test.pl @@ -0,0 +1,41 @@ +# Tests for VMS::Stdio v2.0 +use VMS::Stdio; +import VMS::Stdio qw(&flush &getname &rewind &sync); + +print "1..13\n"; +print +(defined(&getname) ? '' : 'not '), "ok 1\n"; + +$name = "test$$"; +$name++ while -e "$name.tmp"; +$fh = VMS::Stdio::vmsopen("+>$name",'ctx=rec','shr=put','fop=dlt','dna=.tmp'); +print +($fh ? '' : 'not '), "ok 2\n"; + +print +(flush($fh) ? '' : 'not '),"ok 3\n"; +print +(sync($fh) ? '' : 'not '),"ok 4\n"; + +$time = (stat("$name.tmp"))[9]; +print +($time ? '' : 'not '), "ok 5\n"; + +print 'not ' unless print $fh scalar(localtime($time)),"\n"; +print "ok 6\n"; + +print +(rewind($fh) ? '' : 'not '),"ok 7\n"; + +chop($line = <$fh>); +print +($line eq localtime($time) ? '' : 'not '), "ok 8\n"; + +($gotname) = (getname($fh) =~/\](.*);/); +print +($gotname eq "\U$name.tmp" ? '' : 'not '), "ok 9\n"; + +$sfh = VMS::Stdio::vmssysopen($name, O_RDONLY, 0, + 'ctx=rec', 'shr=put', 'dna=.tmp'); +print +($sfh ? '' : 'not ($!) '), "ok 10\n"; + +close($fh); +sysread($sfh,$line,24); +print +($line eq localtime($time) ? '' : 'not '), "ok 11\n"; + +undef $sfh; +print +(stat("$name.tmp") ? 'not ' : ''),"ok 12\n"; + +print +(&VMS::Stdio::tmpnam ? '' : 'not '),"ok 13\n"; |