From c539974a7236fc51f7acd42234a3610958f1b6c1 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 6 Jun 2011 13:12:54 +0200 Subject: [PATCH] In IPC-Open2.t, use functions other than ok(), to generate better diagnostics. --- ext/IPC-Open2/t/IPC-Open2.t | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ext/IPC-Open2/t/IPC-Open2.t b/ext/IPC-Open2/t/IPC-Open2.t index 4c0f82d..e97d8fb 100644 --- a/ext/IPC-Open2/t/IPC-Open2.t +++ b/ext/IPC-Open2/t/IPC-Open2.t @@ -15,7 +15,6 @@ BEGIN { } use strict; -use IO::Handle; use IPC::Open2; use Test::More tests => 7; @@ -30,16 +29,15 @@ sub cmd_line { } } -my ($pid, $reaped_pid); STDOUT->autoflush; STDERR->autoflush; -ok($pid = open2 'READ', 'WRITE', $perl, '-e', - cmd_line('print scalar ')); +my $pid = open2('READ', 'WRITE', $perl, '-e', cmd_line('print scalar ')); +cmp_ok($pid, '>', 1, 'got a sane process ID'); ok(print WRITE "hi kid\n"); -ok( =~ /^hi kid\r?\n$/); +like(, qr/^hi kid\r?\n$/); ok(close(WRITE), "closing WRITE: $!"); ok(close(READ), "closing READ: $!"); -$reaped_pid = waitpid $pid, 0; -ok($reaped_pid == $pid, "Reaped PID: $reaped_pid"); -ok($? == 0, "\$? should be zero ($?)"); +my $reaped_pid = waitpid $pid, 0; +is($reaped_pid, $pid, "Reaped PID matches"); +is($?, 0, '$? should be zero'); -- 2.7.4