X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F30sqlt-diff.t;h=8a34d4ae3c94eb04f6f35eea4bc40f0a77c1ed5f;hb=ace08c3da3d5186a4014a946fd70cf335e051b70;hp=80ced29fe153ed0266cf6376e5d24d9dabeb73b3;hpb=6a0f3000439a978666ecb692f0faaccff3a78c13;p=dbsrgits%2FSQL-Translator.git diff --git a/t/30sqlt-diff.t b/t/30sqlt-diff.t index 80ced29..8a34d4a 100644 --- a/t/30sqlt-diff.t +++ b/t/30sqlt-diff.t @@ -8,7 +8,7 @@ use FindBin qw($Bin); use Test::More; use Test::SQL::Translator qw(maybe_plan); -my @script = qw(blib script sqlt-diff); +my @script = qw(blib script sqlt-diff-old); my @create1 = qw(data sqlite create.sql); my @create2 = qw(data sqlite create2.sql); @@ -25,7 +25,7 @@ my $create2 = (-d "t") : catfile($Bin, "t", @create2); BEGIN { - maybe_plan(20, + maybe_plan(21, 'SQL::Translator::Parser::SQLite', 'SQL::Translator::Parser::MySQL', 'SQL::Translator::Parser::Oracle', @@ -34,7 +34,6 @@ BEGIN { ok(-e $sqlt_diff, 'Found sqlt-diff script'); my @cmd = ($sqlt_diff, "$create1=SQLite", "$create2=SQLite"); - my $out = `@cmd`; like($out, qr/-- Target database SQLite is untested/, "Detected 'untested' comment"); @@ -45,7 +44,7 @@ like($out, qr/ALTER TABLE person ADD is_rock_star/, @cmd = ($sqlt_diff, "$create1=SQLite", "$create1=SQLite"); $out = `@cmd`; -like($out, qr/No differences found/, "Properly detected no differences"); +like($out, qr/There were no differences/, "Properly detected no differences"); my @mysql_create1 = qw(data mysql create.sql); my @mysql_create2 = qw(data mysql create2.sql); @@ -58,6 +57,7 @@ my $mysql_create2 = (-d "t") ? catfile($Bin, @mysql_create2) : catfile($Bin, "t", @mysql_create2); +# Test for differences @cmd = ($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create2=MySQL"); $out = `@cmd`; @@ -70,18 +70,21 @@ like($out, qr/ALTER TABLE person ADD is_rock_star/, "Detected missing rock star field"); like($out, qr/ALTER TABLE person ADD UNIQUE UC_person_id/, "Detected missing unique constraint"); +like($out, qr/CREATE UNIQUE INDEX unique_name/, + "Detected unique index with different name"); like($out, qr/ALTER TABLE person ENGINE=InnoDB;/, "Detected altered table option"); -like($out, qr/ALTER TABLE employee DROP FOREIGN KEY/, +like($out, qr/ALTER TABLE employee DROP FOREIGN KEY FK5302D47D93FE702E/, "Detected drop foreign key"); -like($out, qr/ALTER TABLE employee ADD CONSTRAINT/, +like($out, qr/ALTER TABLE employee ADD CONSTRAINT FK5302D47D93FE702E_diff/, "Detected add constraint"); unlike($out, qr/ALTER TABLE employee ADD PRIMARY KEY/, "Primary key looks different when it shouldn't"); - + +# Test for sameness @cmd = ($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create1=MySQL"); $out = `@cmd`; -like($out, qr/No differences found/, "Properly detected no differences"); +like($out, qr/There were no differences/, "Properly detected no differences"); my @oracle_create1 = qw(data oracle create.sql); my @oracle_create2 = qw(data oracle create2.sql);