Release commit for 1.62
[dbsrgits/SQL-Translator.git] / t / 38-filter-names.t
index ab791c6..4edd793 100644 (file)
@@ -4,31 +4,6 @@
 # Before `make install' is performed this script should be runnable with
 # `make test'. After `make install' it should work as `perl test.pl'
 
-# SQL::Translator::Filter::HelloWorld - Test filter in a package
-#=============================================================================
-package SQL::Translator::Filter::HelloWorld;
-
-use strict;
-use vars qw/$VERSION/;
-$VERSION=0.1;
-
-sub filter {
-    my ($schema,$args) = (shift,shift);
-
-    my $greeting = $args->{greeting} || "Hello";
-    $schema->add_table(
-        name => "HelloWorld",
-    );
-}
-
-# Hack to allow sqlt to see our module as it wasn't loaded from a .pm
-$INC{'SQL/Translator/Filter/HelloWorld.pm'}
-    = 'lib/SQL/Translator/Filter/HelloWorld.pm';
-
-#=============================================================================
-
-package main;
-
 use strict;
 use Test::More;
 use Test::Exception;
@@ -53,26 +28,16 @@ schema:
           name: first_name
 };
 
-#    helloworld:
-#      comments: ''
-#      constraints: []
-#      fields: {}
-#      indices: []
-#      name: HelloWorld
-#      options: []
-#      order: 2
 my $ans_yaml = qq{---
 schema:
   procedures: {}
   tables:
     person:
-      comments: ''
       constraints: []
       fields:
         First_name:
           data_type: foovar
           default_value: ~
-          extra: {}
           is_nullable: 1
           is_primary_key: 0
           is_unique: 0
@@ -96,10 +61,10 @@ translator:
   producer_type: SQL::Translator::Producer::YAML
   show_warnings: 1
   trace: 0
-  version: 0.07
+  version: SUPPRESSED
 };
 
-# Parse the test XML schema
+# Parse the test schema
 my $obj;
 $obj = SQL::Translator->new(
     debug         => 0,
@@ -109,7 +74,7 @@ $obj = SQL::Translator->new(
     data          => $in_yaml,
     filters => [
         # Filter from SQL::Translator::Filter::*
-        [ 'Names', { 
+        [ 'Names', {
             tables => 'lc',
             fields => 'ucfirst',
         } ],
@@ -117,18 +82,11 @@ $obj = SQL::Translator->new(
 
 ) or die "Failed to create translator object: ".SQL::Translator->error;
 
-#sub translate_ok {
-#    my ($sqlt,$ans_yaml,$name) = @_;
-#    $name ||= "";
-#
-#    my $out = eval { $sqlt->translate };
-#    fail( $sqlt->error ) if $sqlt->error;
-#    fail( "No output" ) unless $out;
-#    eq_or_diff $out, $ans_yaml           ,"Translated $name";
-#}
-
 my $out;
 lives_ok { $out = $obj->translate; }  "Translate ran";
 is $obj->error, ''                   ,"No errors";
 ok $out ne ""                        ,"Produced something!";
+# Somewhat hackishly modify the yaml with a regex to avoid
+# failing randomly on every change of version.
+$out =~ s/version: .*/version: SUPPRESSED/;
 eq_or_diff $out, $ans_yaml           ,"Output looks right";