Tab/WS crusade
[dbsrgits/SQL-Translator.git] / t / 31dumper.t
index de39d5d..abf54ce 100644 (file)
@@ -3,16 +3,19 @@
 # Test for Dumper producer
 
 use strict;
-use Config;
-use FindBin qw/$Bin/;
-use Test::More;
 use File::Temp 'tempfile';
+use File::Spec;
+use FindBin qw/$Bin/;
+use IPC::Open3;
 use SQL::Translator;
+use Test::More;
 use Test::SQL::Translator qw(maybe_plan);
+use Symbol qw(gensym);
 
 BEGIN {
     maybe_plan(
-        5, 
+        5,
+        'DBI',
         'SQL::Translator::Parser::SQLite',
         'SQL::Translator::Producer::Dumper'
     );
@@ -43,9 +46,12 @@ my ( $fh, $filename ) = tempfile( 'XXXXXXXX' );
 print $fh $output;
 close $fh or die "Can't close file '$filename': $!";
 
-my $perl = $Config{'perlpath'};
-my $cmd  = "$perl -cw $filename";
-my $res  = `$cmd 2>&1`;
+open( NULL, ">", File::Spec->devnull );
+my $pid = open3( gensym, \*NULL, \*PH, "$^X -cw $filename" );
+my $res;
+while( <PH> ) { $res .= $_;  }
+waitpid($pid, 0);
+
 like( $res, qr/syntax OK/, 'Generated script syntax is OK' );
 
 like( $output, qr{DBI->connect\(\s*'$dsn',\s*'$db_user',\s*'$db_pass',},