diff options
author | Steffen Mueller <smueller@cpan.org> | 2009-09-04 13:06:55 +0200 |
---|---|---|
committer | Steffen Mueller <smueller@cpan.org> | 2009-09-04 13:35:59 +0200 |
commit | ccb5f21d0f8f04b64ed68457c6874d549f54b812 (patch) | |
tree | 8e736809828ac3cd5b1b1b6849481add02e984c8 /ext/IPC-Open2 | |
parent | 7a5216984b4922de7461f5d613e26522071afecb (diff) | |
download | perl-ccb5f21d0f8f04b64ed68457c6874d549f54b812.tar.gz |
Test::More'ify the IPC::Open2 tests
Diffstat (limited to 'ext/IPC-Open2')
-rw-r--r-- | ext/IPC-Open2/t/IPC-Open2.t | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/ext/IPC-Open2/t/IPC-Open2.t b/ext/IPC-Open2/t/IPC-Open2.t index 8a2fd76406..fe2115967c 100644 --- a/ext/IPC-Open2/t/IPC-Open2.t +++ b/ext/IPC-Open2/t/IPC-Open2.t @@ -1,12 +1,13 @@ #!./perl -w +use Config; BEGIN { - require Config; import Config; + require Test::More; if (!$Config{'d_fork'} # open2/3 supported on win32 (but not Borland due to CRT bugs) && (($^O ne 'MSWin32' && $^O ne 'NetWare') || $Config{'cc'} =~ /^bcc/i)) { - print "1..0\n"; + Test::More->import(skip_all => 'open2/3 not available with MSWin32+Netware+cc=bcc'); exit 0; } # make warnings fatal @@ -16,21 +17,10 @@ BEGIN { use strict; use IO::Handle; use IPC::Open2; -#require 'open2.pl'; use subs 'open2'; +use Test::More tests => 7; my $perl = $^X; -sub ok { - my ($n, $result, $info) = @_; - if ($result) { - print "ok $n\n"; - } - else { - print "not ok $n\n"; - print "# $info\n" if $info; - } -} - sub cmd_line { if ($^O eq 'MSWin32' || $^O eq 'NetWare') { return qq/"$_[0]"/; @@ -44,14 +34,12 @@ my ($pid, $reaped_pid); STDOUT->autoflush; STDERR->autoflush; -print "1..7\n"; - -ok 1, $pid = open2 'READ', 'WRITE', $perl, '-e', - cmd_line('print scalar <STDIN>'); -ok 2, print WRITE "hi kid\n"; -ok 3, <READ> =~ /^hi kid\r?\n$/; -ok 4, close(WRITE), $!; -ok 5, close(READ), $!; +ok($pid = open2 'READ', 'WRITE', $perl, '-e', + cmd_line('print scalar <STDIN>')); +ok(print WRITE "hi kid\n"); +ok(<READ> =~ /^hi kid\r?\n$/); +ok(close(WRITE), $!); +ok(close(READ), $!); $reaped_pid = waitpid $pid, 0; -ok 6, $reaped_pid == $pid, $reaped_pid; -ok 7, $? == 0, $?; +ok($reaped_pid == $pid, $reaped_pid); +ok($? == 0, $?); |