mysql_table_type extra data and InnoDB derivation fix.
[dbsrgits/SQL-Translator.git] / t / 21xml-xmi-parser.t
index 773d8b9..558252e 100644 (file)
@@ -5,22 +5,23 @@
 # `make test'. After `make install' it should work as `perl test.pl'
 
 #
-# basic.t
-# -------
-# Tests that;
+# Tests basic functionality and the default xmi2schema
 #
 
 use strict;
-use Test::More;
-use Test::Exception;
-
-use strict;
+use FindBin qw/$Bin/;
 use Data::Dumper;
+
+# run test with -d for debug
 my %opt;
 BEGIN { map { $opt{$_}=1 if s/^-// } @ARGV; }
 use constant DEBUG => (exists $opt{d} ? 1 : 0);
 
-use FindBin qw/$Bin/;
+use Test::More;
+use Test::Exception;
+use Test::SQL::Translator qw(maybe_plan);
+use SQL::Translator;
+use SQL::Translator::Schema::Constants;
 
 # Usefull test subs for the schema objs
 #=============================================================================
@@ -78,25 +79,13 @@ sub test_table {
 # Testing 1,2,3,..
 #=============================================================================
 
-plan tests => 103;
-
-use SQL::Translator;
-use SQL::Translator::Schema::Constants;
+maybe_plan(103,
+    'SQL::Translator::Parser::XML::XMI',
+    'SQL::Translator::Producer::MySQL');
 
 my $testschema = "$Bin/data/xmi/Foo.poseidon2.xmi";
 die "Can't find test schema $testschema" unless -e $testschema;
-my %base_translator_args = ( 
-    filename => $testschema,
-    from     => 'XML-XMI',
-    to       => 'MySQL',
-    debug          => DEBUG,
-    show_warnings  => 1,
-    add_drop_table => 1,
-);
 
-#
-# Basic tests
-#
 my $obj;
 $obj = SQL::Translator->new(
     filename => $testschema,
@@ -104,12 +93,9 @@ $obj = SQL::Translator->new(
     to       => 'MySQL',
     debug          => DEBUG,
     show_warnings  => 1,
-    add_drop_table => 1,
 );
 my $sql = $obj->translate;
 print $sql if DEBUG;
-#print "Debug: translator", Dumper($obj) if DEBUG;
-#print "Debug: schema", Dumper($obj->schema) if DEBUG;
 
 #
 # Test the schema
@@ -119,8 +105,6 @@ my @tblnames = map {$_->name} $scma->get_tables;
 is_deeply( \@tblnames, [qw/Foo PrivateFoo Recording CD Track ProtectedFoo/]
     ,"tables");
 
-# 
-
 #
 # Tables
 #