X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F14postgres-parser.t;h=0c32dd0453e7ff5d295c17915af65e0b63a371de;hb=9a64caf37a2f9092a5a29223e1cbcb2b1c36318b;hp=d81abe10f5efe7f95dc0a30f72143715149f39ae;hpb=fbc0552f2fa97295f7ffd616b7ed8af30e8e025e;p=dbsrgits%2FSQL-Translator.git diff --git a/t/14postgres-parser.t b/t/14postgres-parser.t index d81abe1..0c32dd0 100644 --- a/t/14postgres-parser.t +++ b/t/14postgres-parser.t @@ -5,21 +5,18 @@ use strict; use Test::More; use SQL::Translator; use SQL::Translator::Schema::Constants; +use Test::SQL::Translator qw(maybe_plan); -eval { - require SQL::Translator::Parser::PostgreSQL; +BEGIN { + maybe_plan(119, 'SQL::Translator::Parser::PostgreSQL'); SQL::Translator::Parser::PostgreSQL->import('parse'); -}; -if ($@) { - plan skip_all => "$@"; -} -else { - plan tests => 117; } my $t = SQL::Translator->new( trace => 0 ); my $sql = q[ + -- comment on t_test1 create table t_test1 ( + -- this is the primary key f_serial serial NOT NULL default '0' primary key, f_varchar character varying (255), f_double double precision, @@ -86,6 +83,8 @@ is( scalar @tables, 2, 'Two tables' ); my $t1 = shift @tables; is( $t1->name, 't_test1', 'Table t_test1 exists' ); +is( $t1->comments, 'comment on t_test1', 'Table comment exists' ); + my @t1_fields = $t1->get_fields; is( scalar @t1_fields, 11, '11 fields in t_test1' ); @@ -96,6 +95,7 @@ is( $f1->is_nullable, 0, 'Field cannot be null' ); is( $f1->size, 11, 'Size is "11"' ); is( $f1->default_value, '0', 'Default value is "0"' ); is( $f1->is_primary_key, 1, 'Field is PK' ); +is( $f1->comments, 'this is the primary key', 'Comment' ); is( $f1->is_auto_increment, 1, 'Field is auto increment' ); my $f2 = shift @t1_fields;