From 25dd7e8995357161ee082e6cbee58fd781b673e3 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 6 Jun 2011 12:42:58 +0200 Subject: [PATCH] In IPC-Open3.t, merge two similar tests using a loop. --- ext/IPC-Open3/t/IPC-Open3.t | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/ext/IPC-Open3/t/IPC-Open3.t b/ext/IPC-Open3/t/IPC-Open3.t index a29b550..2d86c7f 100644 --- a/ext/IPC-Open3/t/IPC-Open3.t +++ b/ext/IPC-Open3/t/IPC-Open3.t @@ -105,29 +105,19 @@ $pid = open3 'WRITE', 'READ', '>&STDOUT', print WRITE "ok $test\n"; waitpid $pid, 0; -# dup reader and error together, both named -$pid = open3 'WRITE', '>&STDOUT', '>&STDOUT', $perl, '-e', cmd_line(<<'EOF'); +foreach (['>&STDOUT', 'both named'], + ['', 'error empty'], + ) { + my ($err, $desc) = @$_; + $pid = open3 'WRITE', '>&STDOUT', $err, $perl, '-e', cmd_line(<<'EOF'); $| = 1; print STDOUT scalar ; print STDERR scalar ; EOF -++$test; -print WRITE "ok $test\n"; -++$test; -print WRITE "ok $test\n"; -waitpid $pid, 0; - -# dup reader and error together, error empty -$pid = open3 'WRITE', '>&STDOUT', '', $perl, '-e', cmd_line(<<'EOF'); - $| = 1; - print STDOUT scalar ; - print STDERR scalar ; -EOF -++$test; -print WRITE "ok $test\n"; -++$test; -print WRITE "ok $test\n"; -waitpid $pid, 0; + printf WRITE "ok %d # dup reader and error together, $desc\n", ++$test + for 0, 1; + waitpid $pid, 0; +} # command line in single parameter variant of open3 # for understanding of Config{'sh'} test see exec description in camel book -- 2.7.4