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'
13 BEGIN { map { $opt{$_}=1 if s/^-// } @ARGV; }
14 use constant DEBUG => (exists $opt{d} ? 1 : 0);
15 local $SIG{__WARN__} = sub { diag "[warn] ", @_; };
20 #=============================================================================
22 eval { require Template; };
23 if ($@ && $@ =~ m!locate Template.pm in!) {
24 plan skip_all => "You need Template Toolkit to run this test.";
26 eval { require Test::Differences; };
27 if ($@ && $@ =~ m!locate Test/Differences.pm in!) {
28 plan skip_all => "You need Test::Differences for this test.";
30 use Test::Differences;
34 use SQL::Translator::Producer::TTSchema;
36 # Parse the test XML schema
38 $obj = SQL::Translator->new(
39 debug => DEBUG, #$opt{d},
42 from => "XML-SQLFairy",
43 filename => "$Bin/data/xml/schema-basic.xml",
46 ttfile => "$Bin/data/template/basic.tt",
50 lives_ok { $out = $obj->translate; } "Translate ran";
51 ok $out ne "" ,"Produced something!";
52 local $/ = undef; # slurp
53 eq_or_diff $out, <DATA> ,"Output looks right";
54 # I'm not sure if this diff is the best test, it is probaly too sensitive. But
55 # it at least it will blow up if anything changes!
58 #print "Debug:", Dumper($obj) if DEBUG;
65 ==========================================================================
77 foreign_key_reference:
92 foreign_key_reference:
107 foreign_key_reference:
122 foreign_key_reference:
137 foreign_key_reference:
152 foreign_key_reference:
167 foreign_key_reference: