# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
+local $^W = 0;
+
use strict;
use Test::More;
use Test::Exception;
use Data::Dumper;
-our %opt;
+my %opt;
BEGIN { map { $opt{$_}=1 if s/^-// } @ARGV; }
use constant DEBUG => (exists $opt{d} ? 1 : 0);
use constant TRACE => (exists $opt{t} ? 1 : 0);
eval { require XML::Writer; };
if ($@ && $@ =~ m!locate XML::Writer.pm in!) {
- plan skip_all => "You need XML::Writer to use SqlfXML.";
+ plan skip_all => "You need XML::Writer to use XML::SQLFairy.";
}
eval { require Test::Differences; };
if ($@ && $@ =~ m!locate Test/Differences.pm in!) {
plan tests => 6;
use SQL::Translator;
-use SQL::Translator::Producer::SqlfXML;
+use SQL::Translator::Producer::XML::SQLFairy;
my ($obj,$ans,$xml);
<sqlt:is_nullable>1</sqlt:is_nullable>
<sqlt:is_foreign_key>0</sqlt:is_foreign_key>
<sqlt:order>3</sqlt:order>
- <sqlt:size>0</sqlt:size>
+ <sqlt:size>65535</sqlt:size>
</sqlt:field>
<sqlt:field>
<sqlt:name>email</sqlt:name>
trace => TRACE,
show_warnings => 1,
add_drop_table => 1,
- from => "MySQL",
- to => "SqlfXML",
+ from => 'MySQL',
+ to => 'XML-SQLFairy',
);
lives_ok { $xml = $obj->translate($file); } "Translate ran";
ok("$xml" ne "" ,"Produced something!");
<sqlt:is_nullable>1</sqlt:is_nullable>
<sqlt:is_foreign_key>0</sqlt:is_foreign_key>
<sqlt:order>7</sqlt:order>
- <sqlt:size>0</sqlt:size>
+ <sqlt:size>65535</sqlt:size>
</sqlt:field>
<sqlt:field>
<sqlt:name>email</sqlt:name>
trace => TRACE,
show_warnings => 1,
add_drop_table => 1,
- from => "MySQL",
- to => "SqlfXML",
+ from => 'MySQL',
+ to => 'XML-SQLFairy',
producer_args => { emit_empty_tags => 1 },
);
lives_ok { $xml = $obj->translate($file); } "Translate ran";
# This diff probably isn't a very good test! Should really check the
# result with XPath or something, but that would take ages to write ;-)
-#print "Debug:", Dumper($obj) if DEBUG;
-$obj = SQL::Translator->new(
- debug => DEBUG,
- trace => TRACE,
- show_warnings => 1,
- add_drop_table => 1,
- from => "MySQL",
- to => "SqlfXML",
- producer_args => { emit_empty_tags => 0 },
-);
-print $obj->translate("/home/grommit/src/NADS-build/sql/document.mysql.sql");
+# TODO Make this a real test of attrib_values
+# $obj = SQL::Translator->new(
+# debug => DEBUG,
+# trace => TRACE,
+# show_warnings => 1,
+# add_drop_table => 1,
+# from => "MySQL",
+# to => "XML-SQLFairy",
+# producer_args => { attrib_values => 1 },
+# );
+# print $obj->translate($file);