X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F70sqlt-diff_script.t;h=14962aab5b5ed61a60e21c0725af494f10ea8640;hb=33d693c35afb6bc4489713991672073c5674f626;hp=77c231e0305485e3cc0fb43f98bf06b61033bc45;hpb=3e8e93c07e1d551a149d9d9dae8e28ba92074a68;p=dbsrgits%2FSQL-Translator.git diff --git a/t/70sqlt-diff_script.t b/t/70sqlt-diff_script.t index 77c231e..14962aa 100644 --- a/t/70sqlt-diff_script.t +++ b/t/70sqlt-diff_script.t @@ -8,6 +8,7 @@ use FindBin qw($Bin); use IPC::Open3; use Test::More; use Test::SQL::Translator qw(maybe_plan); +use Text::ParseWords qw(shellwords); my @script = qw(script sqlt-diff); my @create1 = qw(data sqlite create.sql); @@ -35,7 +36,7 @@ my $mysql_create2 = (-d "t") : catfile($Bin, "t", @mysql_create2); # Test for differences -my $out = _run_cmd ($^X, $sqlt_diff, "$mysql_create1=MySQL", "$mysql_create2=MySQL"); +my $out = _run_cmd ($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create2=MySQL"); like($out, qr/CHANGE COLUMN person_id/, "Detected altered 'person_id' field"); like($out, qr/CHANGE COLUMN iq/, "Detected altered 'iq' field"); @@ -54,7 +55,7 @@ like($out, qr/ADD CONSTRAINT FK5302D47D93FE702E_diff/, unlike($out, qr/ADD PRIMARY KEY/, "Primary key looks different when it shouldn't"); # Test for quoted output -$out = _run_cmd ($^X, $sqlt_diff, '--quote=`', "$mysql_create1=MySQL", "$mysql_create2=MySQL"); +$out = _run_cmd ($sqlt_diff, '--quote=`', "$mysql_create1=MySQL", "$mysql_create2=MySQL"); like($out, qr/ALTER TABLE `person`/, "Quoted table name"); like($out, qr/CHANGE COLUMN `person_id`/, "Quoted 'person_id' field"); @@ -63,13 +64,13 @@ like($out, qr/CHANGE COLUMN `name`/, "Quoted 'name' field"); like($out, qr/CHANGE COLUMN `age`/, "Quoted 'age' field"); # Test for sameness -$out = _run_cmd ($^X, $sqlt_diff, "$mysql_create1=MySQL", "$mysql_create1=MySQL"); +$out = _run_cmd ($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create1=MySQL"); like($out, qr/No differences found/, "Properly detected no differences"); sub _run_cmd { my $out; - my $pid = open3( undef, $out, undef, @_ ); + my $pid = open3( undef, $out, undef, $^X, shellwords($ENV{HARNESS_PERL_SWITCHES}||''), @_ ); my $res = do { local $/; <$out> }; waitpid($pid, 0); $res;