X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F17sqlfxml-producer.t;h=54ccf8a515110ad1dc29e5a387dff21fa896964a;hb=ebe497908ca605f223483e859c3dbc724f3d48a0;hp=21722a7a723de5847bbe565d40507b37be89031d;hpb=446dfcbd3a58ad65602cd45c25155bc91d7e25a4;p=dbsrgits%2FSQL-Translator.git diff --git a/t/17sqlfxml-producer.t b/t/17sqlfxml-producer.t index 21722a7..54ccf8a 100644 --- a/t/17sqlfxml-producer.t +++ b/t/17sqlfxml-producer.t @@ -9,6 +9,7 @@ local $^W = 0; use strict; use Test::More; use Test::Exception; +use Test::SQL::Translator qw(maybe_plan); use Data::Dumper; my %opt; @@ -20,25 +21,25 @@ use FindBin qw/$Bin/; my $file = "$Bin/data/mysql/sqlfxml-producer-basic.sql"; +local $SIG{__WARN__} = sub { + CORE::warn(@_) + unless $_[0] =~ m#XML/Writer#; +}; # Testing 1,2,3,4... #============================================================================= -eval { require XML::Writer; }; -if ($@ && $@ =~ m!locate XML::Writer.pm in!) { - plan skip_all => "You need XML::Writer to use XML::SQLFairy."; -} -eval { require Test::Differences; }; -if ($@ && $@ =~ m!locate Test/Differences.pm in!) { - plan skip_all => "You need Test::Differences for this test."; +BEGIN { + maybe_plan(18, + 'XML::Writer', + 'Test::Differences', + 'SQL::Translator::Producer::XML::SQLFairy'); } + use Test::Differences; -plan tests => 18; - use SQL::Translator; use SQL::Translator::Producer::XML::SQLFairy; - # # emit_empty_tags => 0 # @@ -47,91 +48,93 @@ my ($obj,$ans,$xml); $ans = < - + Basic 1 - comment on id field + id integer - 1 - 0 + 10 0 + 1 1 - id + 0 + comment on id field 1 - 10 - + title varchar + 100 + 0 hello 0 - 0 - 0 0 - title + 0 + 2 - 100 - + description text + 65535 + 1 0 - 0 - 1 0 - description + 0 + 3 - 65535 - + email varchar - 0 - 0 + 255 1 + 0 0 - email + 0 + 4 - 255 - title titleindex - NORMAL + title + - 1 - - id - + PRIMARY KEY + id + + + + - - PRIMARY KEY + 1 - 1 - - email - + UNIQUE + email + + + + - - UNIQUE + 1 @@ -163,95 +166,95 @@ my ($obj,$ans,$xml); $ans = < - + Basic 2 - comment on id field + id integer + 10 + 0 1 - 0 - 0 1 - id + 0 + comment on id field 5 - 10 - + title varchar + 100 + 0 hello 0 - 0 - 0 0 - title + 0 + 6 - 100 - + description text + 65535 + 1 0 - 0 - 1 0 - description + 0 + 7 - 65535 - + email varchar + 255 + 1 0 - 0 - 1 0 - email + 0 + 8 - 255 - title titleindex - NORMAL + title + - 1 - - id - + PRIMARY KEY + id + + + + - - - PRIMARY KEY + 1 - 1 - - email - + UNIQUE + email + + + + - - - UNIQUE + 1 @@ -283,20 +286,20 @@ eq_or_diff $xml, $ans ,"XML looks right"; my ($obj,$ans,$xml); $ans = < + - - - - + + + + - + - - + + @@ -329,13 +332,13 @@ my ($obj,$ans,$xml); $ans = < - + - name,age foo_view - 1 select name, age from person + name,age + 1 EOXML @@ -378,15 +381,15 @@ my ($obj,$ans,$xml); $ans = < - + - update modified=timestamp(); - insert foo_trigger + insert + update modified=timestamp(); foo - 1 after + 1 EOXML @@ -432,15 +435,15 @@ my ($obj,$ans,$xml); $ans = < - + - Go Sox! foo_proc - 1 - Nomar - foo,bar select foo from bar + foo,bar + Nomar + Go Sox! + 1 EOXML @@ -466,7 +469,7 @@ EOXML owner => $owner, comments => $comments, ) or die $s->error; - + # As we have created a Schema we give translate a dummy string so that # it will run the produce. lives_ok {$xml =$obj->translate("FOO");} "Translate (Procedure) ran";