Release commit for 1.62
[dbsrgits/SQL-Translator.git] / t / 34tt-base.t
CommitLineData
952b2663 1#!/usr/bin/perl -w
f5f03b78 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
f5f03b78 12BEGIN {
3e1ed76b 13 maybe_plan(4, 'Template 2.20',
14 'Test::Differences',
8c4efd11 15 'SQL::Translator::Parser::XML::SQLFairy')
f5f03b78 16}
17use Test::Differences;
18
19use SQL::Translator;
952b2663 20use FindBin qw/$Bin/;
21# Access to test libs. We want Producer/BaseTest.pm from here.
22use lib ("$Bin/lib");
23
f5f03b78 24
25# Parse the test XML schema
26my $obj;
27$obj = SQL::Translator->new(
952b2663 28 debug => 0,
9768b204 29 show_warnings => 0,
f5f03b78 30 add_drop_table => 1,
31 from => "XML-SQLFairy",
7266dab2 32 filename => "$Bin/data/xml/schema.xml",
f5f03b78 33 to => "Producer::BaseTest::produce",
f5f03b78 34);
35my $out;
36lives_ok { $out = $obj->translate; } "Translate ran";
37is $obj->error, '' ,"No errors";
38ok $out ne "" ,"Produced something!";
39local $/ = undef; # slurp
40eq_or_diff $out, <DATA> ,"Output looks right";
41
f5f03b78 42
43__DATA__
44Hello World
b08b5416 45Tables: Basic, Another
53ec8b7d 46
f5f03b78 47Basic
53ec8b7d 48------
b08b5416 49Fields: id title description email explicitnulldef explicitemptystring emptytagdef another_id timest
50
51Another
52------
e3472b3b 53Fields: id num
b08b5416 54