Added Chris Hilton's patch so version number test is based on current version and...
[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 {
13 maybe_plan(4, 'Template', 'Test::Differences')
14}
15use Test::Differences;
16
17use SQL::Translator;
952b2663 18use FindBin qw/$Bin/;
19# Access to test libs. We want Producer/BaseTest.pm from here.
20use lib ("$Bin/lib");
21
f5f03b78 22
23# Parse the test XML schema
24my $obj;
25$obj = SQL::Translator->new(
952b2663 26 debug => 0,
f5f03b78 27 show_warnings => 1,
28 add_drop_table => 1,
29 from => "XML-SQLFairy",
7266dab2 30 filename => "$Bin/data/xml/schema.xml",
f5f03b78 31 to => "Producer::BaseTest::produce",
f5f03b78 32);
33my $out;
34lives_ok { $out = $obj->translate; } "Translate ran";
35is $obj->error, '' ,"No errors";
36ok $out ne "" ,"Produced something!";
37local $/ = undef; # slurp
38eq_or_diff $out, <DATA> ,"Output looks right";
39
f5f03b78 40
41__DATA__
42Hello World
53ec8b7d 43Tables: Basic
44
f5f03b78 45Basic
53ec8b7d 46------
47Fields: id title description email explicitnulldef explicitemptystring emptytagdef