Test Str and ArrayRef input for SQLT->filename
[dbsrgits/SQL-Translator.git] / t / 60roundtrip.t
index f2d491a..f04417f 100644 (file)
@@ -8,6 +8,7 @@ use Test::Differences;
 use FindBin qw/$Bin/;
 
 use SQL::Translator;
+use SQL::Translator::Utils qw/ddl_parser_instance/;
 
 
 ### Set $ENV{SQLTTEST_RT_DEBUG} = 1 for more output
@@ -17,9 +18,11 @@ my $plan = [
   {
     engine => 'XML',
     req => 'XML::LibXML 1.69',
+    no_grammar => 1,
   },
   {
     engine => 'YAML',
+    no_grammar => 1,
   },
 
   {
@@ -55,24 +58,24 @@ my $plan = [
     parser_args => {},
   },
 
-#  {
-#    engine => 'Oracle',
-#    producer_args => {},
-#    parser_args => {},
-#    todo => 'Needs volunteers',
-#  },
-#  {
-#    engine => 'Sybase',
-#    producer_args => {},
-#    parser_args => {},
-#    todo => 'Needs volunteers',
-#  },
-#  {
-#    engine => 'DB2',
-#    producer_args => {},
-#    parser_args => {},
-#    todo => 'Needs volunteers',
-#  },
+  {
+    engine => 'Oracle',
+    producer_args => {},
+    parser_args => {},
+    todo => 'Needs volunteers',
+  },
+  {
+    engine => 'Sybase',
+    producer_args => {},
+    parser_args => {},
+    todo => 'Needs volunteers',
+  },
+  {
+    engine => 'DB2',
+    producer_args => {},
+    parser_args => {},
+    todo => 'Needs volunteers',
+  },
 
 # There is no Access producer
 #  {
@@ -121,9 +124,21 @@ for my $args (@$plan) {
       );
     }
 
+    use_ok("SQL::Translator::Producer::$args->{engine}");
+    use_ok("SQL::Translator::Parser::$args->{engine}");
+
+    ok(ddl_parser_instance($args->{engine}), 'Got proper parser instance')
+      unless $args->{no_grammar};
+
     TODO: {
       local $TODO = $args->{todo} if $args->{todo};
 
+      no warnings 'once';
+      # silence PR::D from spewing on STDERR
+      local $::RD_ERRORS = 0 if $args->{todo};
+      local $::RD_WARN = 0 if $args->{todo};
+      local $::RD_HINT = 0 if $args->{todo};
+
       lives_ok (
         sub { check_roundtrip ($args, $base_schema) },
         "Round trip for $args->{name} did not throw an exception",
@@ -211,9 +226,9 @@ sub check_roundtrip {
 
 # the two sql strings should be identical
   my $msg = "$args->{name} SQL roundtrip successful - SQL statements match";
-  $ENV{SQLTTEST_RT_DEBUG}     #stringify below because IO::Scalar does not behave nice
-    ? eq_or_diff ("$rt_out", "$base_out", $msg)
-    : ok ("$rt_out" eq "$base_out", $msg)
+  $ENV{SQLTTEST_RT_DEBUG}
+    ? eq_or_diff ($rt_out, $base_out, $msg)
+    : ok ($rt_out eq $base_out, $msg)
   ;
 }