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);
14 BEGIN { map { $opt{$_}=1 if s/^-// } @ARGV; }
15 use constant DEBUG => (exists $opt{d} ? 1 : 0);
16 local $SIG{__WARN__} = sub { diag "[warn] ", @_; };
21 #=============================================================================
24 maybe_plan(3, 'Template', 'Test::Differences')
26 use Test::Differences;
29 use SQL::Translator::Producer::TTSchema;
31 # Parse the test XML schema
33 $obj = SQL::Translator->new(
34 debug => DEBUG, #$opt{d},
37 from => "XML-SQLFairy",
38 filename => "$Bin/data/xml/schema-basic.xml",
41 ttfile => "$Bin/data/template/basic.tt",
45 lives_ok { $out = $obj->translate; } "Translate ran";
46 ok $out ne "" ,"Produced something!";
47 local $/ = undef; # slurp
48 eq_or_diff $out, <DATA> ,"Output looks right";
49 # I'm not sure if this diff is the best test, it is probaly too sensitive. But
50 # it at least it will blow up if anything changes!
53 #print "Debug:", Dumper($obj) if DEBUG;
60 ==========================================================================
72 foreign_key_reference:
87 foreign_key_reference:
102 foreign_key_reference:
117 foreign_key_reference:
132 foreign_key_reference:
147 foreign_key_reference:
162 foreign_key_reference: