From: Darren Chamberlain Date: Thu, 11 Mar 2004 18:12:01 +0000 (+0000) Subject: Readding, at kyc's request. X-Git-Tag: v0.06~137 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=034bdbe4026bbe24133c15a1b077b12be9d50782;p=dbsrgits%2FSQL-Translator.git Readding, at kyc's request. --- diff --git a/t/30sqlt-diff.t b/t/30sqlt-diff.t new file mode 100644 index 0000000..c745dae --- /dev/null +++ b/t/30sqlt-diff.t @@ -0,0 +1,41 @@ +#!/usr/bin/perl +# vim: set ft=perl: + +use strict; + +use File::Spec::Functions qw(catfile updir tmpdir); +use FindBin qw($Bin); +use Test::More; +use Test::SQL::Translator qw(maybe_plan); + +my @script = qw(blib script sqlt-diff); +my @create1 = qw(data sqlite create.sql); +my @create2 = qw(data sqlite create2.sql); + +my $sqlt_diff = (-d "blib") + ? catfile($Bin, updir, @script) + : catfile($Bin, @script); + +my $create1 = (-d "t") + ? catfile($Bin, @create1) + : catfile($Bin, "t", @create1); + +my $create2 = (-d "t") + ? catfile($Bin, @create2) + : catfile($Bin, "t", @create2); + +BEGIN { + maybe_plan(3, + 'SQL::Translator::Parser::SQLite', + 'SQL::Translator::Producer::YAML', + ); +} + +ok(-e $sqlt_diff, 'Found sqlt-diff script'); +my @cmd = ($sqlt_diff, "$create1=SQLite", "$create2=SQLite"); + +my $out = `@cmd`; + +like($out, qr/ALTER TABLE person CHANGE iq/, "Detected altered 'iq' field"); +like($out, qr/ALTER TABLE person ADD is_rock_star/, + "Detected missing rock star field");