[feedgnuplot] 31/42: test now uses IPC::Run directly instead of Test::Script::Run

Dima Kogan dkogan-guest at alioth.debian.org
Sun Oct 20 08:04:09 UTC 2013


This is an automated email from the git hooks/post-receive script.

dkogan-guest pushed a commit to tag v1.25
in repository feedgnuplot.

commit 59625675f7ea2c0e3c7b9e15146740a3c271e6a4
Author: Dima Kogan <dima at secretsauce.net>
Date:   Sat Oct 19 21:31:23 2013 -0700

    test now uses IPC::Run directly instead of Test::Script::Run
    
    This is required for the streaming tests I'm about to write. Test::Script::Run
    doesn't know how to feed input from one process to another as the data comes in
---
 t/plots.t |   32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/t/plots.t b/t/plots.t
index a5e26fe..63c8826 100644
--- a/t/plots.t
+++ b/t/plots.t
@@ -15,9 +15,11 @@ BEGIN {
   }
 }
 
-use Test::More tests => 16;
-use Test::Script::Run 'is_script_output';
+use Test::More tests => 32;
 use File::Temp 'tempfile';
+use IPC::Run 'run';
+use String::ShellQuote;
+use File::Basename;
 
 tryplot( testname => 'basic line plot',
          cmd      => 'seq 5',
@@ -820,24 +822,28 @@ tryplot( testname => 'Monotonicity check',
 
 EOF
 
+
+
+
+
 sub tryplot
 {
   my %args = @_;
 
-  my ($fh, $input_filename) = tempfile( UNLINK => 1);
-  open IN, '-|', $args{cmd};
-  print $fh <IN>;
-  close IN;
-  close $fh;
-
   my @options = ('--exit',
                  '--extracmds', 'unset grid',
-                 '--terminal', 'dumb 40,40',
-                 $input_filename);
+                 '--terminal', 'dumb 40,40');
 
   unshift @options, @{$args{options}};
 
-  is_script_output( 'feedgnuplot', \@options,
-                    [$args{refplot} =~ /(.*)\n/g], [],
-                    $args{testname});
+  my $out = '';
+  my $err = '';
+  open IN, '-|', $args{cmd} or die "Couldn't open pipe to $args{cmd}";
+  run [dirname($0) . "/../bin/feedgnuplot",, @options],
+    \*IN, \$out, \$err;
+
+  note( "Running test '$args{testname}'. Running: $args{cmd} | feedgnuplot " .
+        shell_quote(@options));
+  is($err, '',             "$args{testname} stderr" );
+  is($out, $args{refplot}, "$args{testname} stdout");
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/feedgnuplot.git



More information about the debian-science-commits mailing list