Commit | Line | Data |
5f05dabc |
1 | # Tests for VMS::Stdio v2.01 |
17421385 |
2 | use VMS::Stdio; |
3 | import VMS::Stdio qw(&flush &getname &rewind &sync); |
4 | |
5f05dabc |
5 | print "1..14\n"; |
17421385 |
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 | |
5f05dabc |
19 | $fh->autoflush; # Can we autoload autoflush from IO::File? Do or die. |
17421385 |
20 | print "ok 6\n"; |
21 | |
5f05dabc |
22 | print 'not ' unless print $fh scalar(localtime($time)),"\n"; |
23 | print "ok 7\n"; |
24 | |
25 | print +(rewind($fh) ? '' : 'not '),"ok 8\n"; |
17421385 |
26 | |
27 | chop($line = <$fh>); |
5f05dabc |
28 | print +($line eq localtime($time) ? '' : 'not '), "ok 9\n"; |
17421385 |
29 | |
30 | ($gotname) = (getname($fh) =~/\](.*);/); |
5f05dabc |
31 | print +($gotname eq "\U$name.tmp" ? '' : 'not '), "ok 10\n"; |
17421385 |
32 | |
33 | $sfh = VMS::Stdio::vmssysopen($name, O_RDONLY, 0, |
34 | 'ctx=rec', 'shr=put', 'dna=.tmp'); |
5f05dabc |
35 | print +($sfh ? '' : 'not ($!) '), "ok 11\n"; |
17421385 |
36 | |
37 | close($fh); |
38 | sysread($sfh,$line,24); |
5f05dabc |
39 | print +($line eq localtime($time) ? '' : 'not '), "ok 12\n"; |
17421385 |
40 | |
41 | undef $sfh; |
5f05dabc |
42 | print +(stat("$name.tmp") ? 'not ' : ''),"ok 13\n"; |
17421385 |
43 | |
5f05dabc |
44 | print +(&VMS::Stdio::tmpnam ? '' : 'not '),"ok 14\n"; |