Some updates to tests to skip when required dependencies are missing.
[dbsrgits/SQL-Translator.git] / t / 15oracle-parser.t
index 635313e..a5098e4 100644 (file)
@@ -1,10 +1,14 @@
 #!/usr/bin/perl
+# vim: set ft=perl:
 
 use strict;
-use Test::More tests => 73;
+use Test::More;
 use SQL::Translator;
 use SQL::Translator::Schema::Constants;
-use SQL::Translator::Parser::Oracle qw(parse);
+use Test::SQL::Translator qw(maybe_plan);
+
+maybe_plan(76, 'SQL::Translator::Parser::Oracle');
+SQL::Translator::Parser::Oracle->import('parse');
 
 my $t   = SQL::Translator->new( trace => 0 );
 my $sql = q[
@@ -15,7 +19,8 @@ my $sql = q[
         trait_category              VARCHAR2(100)   NOT NULL,
         UNIQUE ( trait_category )
     );
-    comment on table qtl_trait_category is 'hey, hey, hey, hey';
+    COMMENT ON TABLE qtl_trait_category IS 
+    'hey, hey, hey, hey';
     comment on column qtl_trait_category.qtl_trait_category_id 
         is 'the primary key!';
 
@@ -32,21 +37,24 @@ my $sql = q[
         FOREIGN KEY ( qtl_trait_category_id ) REFERENCES qtl_trait_category
     );
 
+    /* qtl table comment */
     CREATE TABLE qtl
     (
+        /* qtl_id comment */
         qtl_id              NUMBER(11)      NOT NULL    
             CONSTRAINT pk_qtl PRIMARY KEY,
-        qtl_accession_id    VARCHAR2(20)    NOT NULL,
+        qtl_accession_id    VARCHAR2(20)    NOT NULL /* accession comment */,
         published_symbol    VARCHAR2(100),
         qtl_trait_id        NUMBER(11)      NOT NULL,
         linkage_group       VARCHAR2(32)    NOT NULL,
         start_position      NUMBER(11,2)    NOT NULL,
         stop_position       NUMBER(11,2)    NOT NULL,
         comments            long,
-        UNIQUE ( qtl_accession_id ),
         FOREIGN KEY ( qtl_trait_id ) REFERENCES qtl_trait
     );
 
+    CREATE UNIQUE INDEX qtl_accession ON qtl ( qtl_accession_id );
+
     CREATE TABLE qtl_trait_synonym
     (
         qtl_trait_synonym_id    NUMBER(11)      NOT NULL    
@@ -200,6 +208,15 @@ is( scalar @t3_fields, 8, '8 fields in table' );
 my @t3_constraints = $t3->get_constraints;
 is( scalar @t3_constraints, 3, '3 constraints on table' );
 
+is( $t3->comments, 'qtl table comment', 'Comment "qtl table comment" exists' );
+
+my $t3_f1     = shift @t3_fields;
+is( $t3_f1->comments, 'qtl_id comment', 'Comment "qtl_id comment" exists' );
+
+my $t3_f2     = shift @t3_fields;
+is( $t3_f2->comments, 'accession comment', 
+    'Comment "accession comment" exists' );
+
 #
 # qtl_trait_synonym
 #