summaryrefslogtreecommitdiff
path: root/vms/ext/Stdio/test.pl
diff options
context:
space:
mode:
Diffstat (limited to 'vms/ext/Stdio/test.pl')
-rwxr-xr-xvms/ext/Stdio/test.pl30
1 files changed, 27 insertions, 3 deletions
diff --git a/vms/ext/Stdio/test.pl b/vms/ext/Stdio/test.pl
index 0b50d63e3a..36353d91b3 100755
--- a/vms/ext/Stdio/test.pl
+++ b/vms/ext/Stdio/test.pl
@@ -1,8 +1,8 @@
-# Tests for VMS::Stdio v2.01
+# Tests for VMS::Stdio v2.1
use VMS::Stdio;
-import VMS::Stdio qw(&flush &getname &rewind &sync);
+import VMS::Stdio qw(&flush &getname &rewind &sync &tmpnam);
-print "1..14\n";
+print "1..19\n";
print +(defined(&getname) ? '' : 'not '), "ok 1\n";
$name = "test$$";
@@ -42,3 +42,27 @@ undef $sfh;
print +(stat("$name.tmp") ? 'not ' : ''),"ok 13\n";
print +(&VMS::Stdio::tmpnam ? '' : 'not '),"ok 14\n";
+
+if (open(P, qq[| MCR $^X -e "1 while (<STDIN>);print 'Foo';1 while (<STDIN>); print 'Bar'" >$name.tmp])) {
+ print P "Baz\nQuux\n";
+ print +(VMS::Stdio::writeof(P) ? '' : 'not '),"ok 15\n";
+ print P "Baz\nQuux\n";
+ print +(close(P) ? '' : 'not '),"ok 16\n";
+ $fh = VMS::Stdio::vmsopen("$name.tmp");
+ chomp($line = <$fh>);
+ close $fh;
+ unlink("$name.tmp");
+ print +($line eq 'FooBar' ? '' : 'not '),"ok 17\n";
+}
+else { print "not ok 15\nnot ok 16\nnot ok 17\n"; }
+
+$sfh = VMS::Stdio::vmsopen(">$name.tmp");
+$setuperl = "\$ MCR $^X\nBEGIN { \@INC = qw(@INC) };\nuse VMS::Stdio qw(&setdef);";
+print $sfh qq[\$ here = F\$Environment("Default")\n];
+print $sfh "$setuperl\nsetdef();\n\$ Show Default\n\$ Set Default 'here'\n";
+print $sfh "$setuperl\nsetdef('..');\n\$ Show Default\n";
+close $sfh;
+@defs = map { /(\S+)/ && $1 } `\@$name.tmp`;
+unlink("$name.tmp");
+print +($defs[0] eq uc($ENV{'SYS$LOGIN'}) ? '' : "not ($defs[0]) "),"ok 18\n";
+print +($defs[1] eq VMS::Filespec::rmsexpand('[-]') ? '' : "not ($defs[1]) "),"ok 19\n";