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 #=============================================================================
19 eval {require Template;};
22 plan skip_all => 'Template not installed?'
27 'SQL::Translator::Parser::XML::SQLFairy',
32 use Test::Differences;
35 use SQL::Translator::Producer::TTSchema;
37 # Main test. Template whole schema and test tt_vars
40 $obj = SQL::Translator->new(
42 from => "XML-SQLFairy",
43 filename => "$Bin/data/xml/schema.xml",
46 ttfile => "$Bin/data/template/basic.tt",
54 lives_ok { $out = $obj->translate; } "Translate ran";
55 ok $out ne "" ,"Produced something!";
56 local $/ = undef; # slurp
57 eq_or_diff $out, <DATA> ,"Output looks right";
60 # Test passing of Template config
63 [%- FOREACH table = schema.get_tables %]
67 $obj = SQL::Translator->new(
69 from => "XML-SQLFairy",
70 filename => "$Bin/data/xml/schema.xml",
84 lives_ok { $out = $obj->translate; } "Translate ran";
85 ok $out ne "" ,"Produced something!";
86 local $/ = undef; # slurp
90 ,"Output looks right";
102 ==========================================================================
114 foreign_key_reference:
128 foreign_key_reference:
142 foreign_key_reference:
156 foreign_key_reference:
170 foreign_key_reference:
184 foreign_key_reference:
198 foreign_key_reference:
212 foreign_key_reference: Another
226 foreign_key_reference:
274 reference_table: Another
282 ==========================================================================
294 foreign_key_reference: