4 # Before `make install' is performed this script should be runnable with
5 # `make test'. After `make install' it should work as `perl test.pl'
10 use Test::SQL::Translator qw(maybe_plan);
16 #=============================================================================
20 'SQL::Translator::Parser::XML::SQLFairy',
25 use Test::Differences;
28 use SQL::Translator::Producer::TTSchema;
30 # Main test. Template whole schema and test tt_vars
33 $obj = SQL::Translator->new(
35 from => "XML-SQLFairy",
36 filename => "$Bin/data/xml/schema.xml",
39 ttfile => "$Bin/data/template/basic.tt",
47 lives_ok { $out = $obj->translate; } "Translate ran";
48 ok $out ne "" ,"Produced something!";
49 local $/ = undef; # slurp
50 eq_or_diff $out, <DATA> ,"Output looks right";
53 # Test passing of Template config
56 [%- FOREACH table = schema.get_tables %]
60 $obj = SQL::Translator->new(
62 from => "XML-SQLFairy",
63 filename => "$Bin/data/xml/schema.xml",
77 lives_ok { $out = $obj->translate; } "Translate ran";
78 ok $out ne "" ,"Produced something!";
79 local $/ = undef; # slurp
83 ,"Output looks right";
95 ==========================================================================
107 foreign_key_reference:
121 foreign_key_reference:
135 foreign_key_reference:
149 foreign_key_reference:
163 foreign_key_reference:
177 foreign_key_reference:
191 foreign_key_reference:
205 foreign_key_reference: Another
219 foreign_key_reference:
267 reference_table: Another
275 ==========================================================================
287 foreign_key_reference:
301 foreign_key_reference: