diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1996-07-22 18:13:12 +0000 |
---|---|---|
committer | Charles Bailey <bailey@genetics.upenn.edu> | 1996-07-22 18:13:12 +0000 |
commit | 61f2b451fd3c78c4b8481e1a3a89cadc6e3119ae (patch) | |
tree | b2405db891f2d901e5d2fd09eb6caedc4985b20f /t/lib/io_dup.t | |
parent | 5ef887f565b93732e1d57415b9f72359f638b378 (diff) | |
download | perl-61f2b451fd3c78c4b8481e1a3a89cadc6e3119ae.tar.gz |
Add tests for new IO extension
Diffstat (limited to 't/lib/io_dup.t')
-rw-r--r-- | t/lib/io_dup.t | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/t/lib/io_dup.t b/t/lib/io_dup.t new file mode 100644 index 0000000000..ac1768383a --- /dev/null +++ b/t/lib/io_dup.t @@ -0,0 +1,45 @@ +#!./perl + +BEGIN { + @INC = '../lib'; + require Config; import Config; + if ($Config{'extensions'} !~ /\bIO\b/ && $^O ne 'VMS') { + print "1..0\n"; + exit 0; + } +} + +use IO::Handle; +use IO::File; + +select(STDERR); $| = 1; +select(STDOUT); $| = 1; + +print "1..6\n"; + +print "ok 1\n"; + +$dupout = IO::Handle->new->fdopen( \*STDOUT ,"w"); +$duperr = IO::Handle->new->fdopen( \*STDERR ,"w"); + +$stdout = \*STDOUT; bless $stdout, "IO::File"; # "IO::Handle"; +$stderr = \*STDERR; bless $stderr, "IO::Handle"; + +$stdout->open( "Io.dup","w") || die "Can't open stdout"; +$stderr->fdopen($stdout,"w"); + +print $stdout "ok 2\n"; +print $stderr "ok 3\n"; +system 'echo ok 4'; +system 'echo ok 5 1>&2'; + +$stderr->close; +$stdout->close; + +$stdout->fdopen($dupout,"w"); +$stderr->fdopen($duperr,"w"); + +system 'cat Io.dup'; +unlink 'Io.dup'; + +print STDOUT "ok 6\n"; |