fixes for code clarity
[dbsrgits/SQL-Translator.git] / t / 18ttschema-producer.t
index afe5025..d087b1d 100644 (file)
@@ -7,29 +7,23 @@
 use strict;
 use Test::More;
 use Test::Exception;
+use Test::SQL::Translator qw(maybe_plan);
 
 use Data::Dumper;
 use vars '%opt';
 BEGIN { map { $opt{$_}=1 if s/^-// } @ARGV; }
 use constant DEBUG => (exists $opt{d} ? 1 : 0);
-local $SIG{__WARN__} = sub { diag "[warn] ", @_; };
 
 use FindBin qw/$Bin/;
 
 # Testing 1,2,3,4...
 #=============================================================================
 
-eval { require Template; };
-if ($@ && $@ =~ m!locate Template.pm in!) {
-    plan skip_all => "You need Template Toolkit to run this test.";
-}
-eval { require Test::Differences; };
-if ($@ && $@ =~ m!locate Test/Differences.pm in!) {
-    plan skip_all => "You need Test::Differences for this test.";
+BEGIN {
+    maybe_plan(3, 'Template', 'Test::Differences')
 }
 use Test::Differences;
-plan tests => 3;
-    
+
 use SQL::Translator;
 use SQL::Translator::Producer::TTSchema;
 
@@ -51,8 +45,6 @@ lives_ok { $out = $obj->translate; }  "Translate ran";
 ok $out ne ""                        ,"Produced something!";
 local $/ = undef; # slurp
 eq_or_diff $out, <DATA>              ,"Output looks right";
-# I'm not sure if this diff is the best test, it is probaly too sensitive. But 
-# it at least it will blow up if anything changes!
 
 print $out if DEBUG;
 #print "Debug:", Dumper($obj) if DEBUG;