1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
# $Id: 960-rt56357-database-model.t,v 1.2 2010/04/10 12:58:16 aff Exp $
use warnings;
use strict;
use Data::Dumper;
use Test::More;
use Test::Exception;
use File::Spec::Functions;
use lib catdir qw ( blib lib );
plan tests => 5;
use lib q{lib};
use_ok('Parse::Dia::SQL');
my $diasql = Parse::Dia::SQL->new(
file => catfile(qw(t data rt56357.dia)),
db => 'postgres'
);
isa_ok($diasql, q{Parse::Dia::SQL}, q{Expect a Parse::Dia::SQL object});
can_ok($diasql, q{get_sql});
my $sql = undef;
lives_ok(sub { $sql = $diasql->get_sql() },
q{get_sql should live on supported model type 'Database - Table'});
diag($sql);
like($sql, qr/.*
create \s* table \s* bar \s* \( \s*
\s* foo \s+ int \s+ not \s+ null \s*, \s*
\s* seconds \s+ int \s+ not \s+ null \s*, \s*
\s* constraint \s+ pk_bar \s+ primary \s+ key \s+ \( \s* foo \s* \) \s* \)
.*/six);
__END__
=pod
=head1 DESCRIPTION
The I<database> model type was added to dia in recent versions.
=cut
|