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 #=============================================================================
21 'SQL::Translator::Parser::XML::SQLFairy',
26 use Test::Differences;
29 use SQL::Translator::Producer::TTSchema;
31 # Main test. Template whole schema and test tt_vars
34 $obj = SQL::Translator->new(
36 from => "XML-SQLFairy",
37 filename => "$Bin/data/xml/schema.xml",
40 ttfile => "$Bin/data/template/basic.tt",
41 # ttfile => "$Bin/data/template/test.tt",
49 lives_ok { $out = $obj->translate; } "Translate ran";
50 # print STDERR "Output: $out\n";
51 ok $out ne "" ,"Produced something!";
52 local $/ = undef; # slurp
53 eq_or_diff $out, <DATA> ,"Output looks right";
56 # Test passing of Template config
59 [%- FOREACH table = schema.get_tables %]
63 $obj = SQL::Translator->new(
65 from => "XML-SQLFairy",
66 filename => "$Bin/data/xml/schema.xml",
80 lives_ok { $out = $obj->translate; } "Translate ran";
81 ok $out ne "" ,"Produced something!";
82 local $/ = undef; # slurp
86 ,"Output looks right";
98 ==========================================================================
110 foreign_key_reference:
124 foreign_key_reference:
138 foreign_key_reference:
152 foreign_key_reference:
166 foreign_key_reference:
180 foreign_key_reference:
194 foreign_key_reference:
208 foreign_key_reference: Another
222 foreign_key_reference:
270 reference_table: Another
278 ==========================================================================
290 foreign_key_reference: