Updated to test the new, single format sqlf xml.
[dbsrgits/SQL-Translator.git] / t / 34tt-base.t
CommitLineData
f5f03b78 1#!/usr/bin/perl -w
2# vim:filetype=perl
3
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'
6
7use strict;
8use Test::More;
9use Test::Exception;
10use Test::SQL::Translator qw(maybe_plan);
11
12use Data::Dumper;
13use vars '%opt';
14BEGIN { map { $opt{$_}=1 if s/^-// } @ARGV; }
15use constant DEBUG => (exists $opt{d} ? 1 : 0);
16
17use FindBin qw/$Bin/;
18use lib ("$Bin/lib");
19
20# Testing 1,2,3,4...
21#=============================================================================
22package main;
23
24BEGIN {
25 maybe_plan(4, 'Template', 'Test::Differences')
26}
27use Test::Differences;
28
29use SQL::Translator;
30use SQL::Translator::Producer::TTSchema;
31
32# Parse the test XML schema
33my $obj;
34$obj = SQL::Translator->new(
35 debug => DEBUG, #$opt{d},
36 show_warnings => 1,
37 add_drop_table => 1,
38 from => "XML-SQLFairy",
39 filename => "$Bin/data/xml/schema-basic.xml",
40 to => "Producer::BaseTest::produce",
f5f03b78 41);
42my $out;
43lives_ok { $out = $obj->translate; } "Translate ran";
44is $obj->error, '' ,"No errors";
45ok $out ne "" ,"Produced something!";
46local $/ = undef; # slurp
47eq_or_diff $out, <DATA> ,"Output looks right";
48
49print $out if DEBUG;
50#print "Debug:", Dumper($obj) if DEBUG;
51
52__DATA__
53Hello World
53ec8b7d 54Tables: Basic
55
f5f03b78 56Basic
53ec8b7d 57------
58Fields: id title description email explicitnulldef explicitemptystring emptytagdef