Commit | Line | Data |
a78e3fed |
1 | use strict; |
c2849787 |
2 | use lib qw(t/lib); |
fbd83464 |
3 | use dbixcsl_common_tests; |
fdd8ff16 |
4 | use Test::More; |
a78e3fed |
5 | |
9e978a19 |
6 | my $dsn = $ENV{DBICTEST_PG_DSN} || ''; |
7 | my $user = $ENV{DBICTEST_PG_USER} || ''; |
8 | my $password = $ENV{DBICTEST_PG_PASS} || ''; |
a78e3fed |
9 | |
fbd83464 |
10 | my $tester = dbixcsl_common_tests->new( |
a78e3fed |
11 | vendor => 'Pg', |
12 | auto_inc_pk => 'SERIAL NOT NULL PRIMARY KEY', |
9e978a19 |
13 | dsn => $dsn, |
a78e3fed |
14 | user => $user, |
15 | password => $password, |
fdd8ff16 |
16 | extra => { |
17 | create => [ |
18 | q{ |
19 | CREATE TABLE pg_loader_test1 ( |
20 | id SERIAL NOT NULL PRIMARY KEY, |
21 | value VARCHAR(100) |
22 | ) |
23 | }, |
24 | q{ |
25 | COMMENT ON TABLE pg_loader_test1 IS 'The Table' |
26 | }, |
27 | q{ |
28 | COMMENT ON COLUMN pg_loader_test1.value IS 'The Column' |
29 | }, |
30 | ], |
31 | drop => [ qw/ pg_loader_test1 / ], |
32 | count => 2, |
33 | run => sub { |
34 | my ($schema, $monikers, $classes) = @_; |
35 | |
36 | my $class = $classes->{pg_loader_test1}; |
37 | my $filename = $schema->_loader->_get_dump_filename($class); |
38 | |
39 | my $code = do { |
40 | local ($/, @ARGV) = (undef, $filename); |
41 | <>; |
42 | }; |
43 | |
44 | like $code, qr/^=head1 NAME\n\n^$class - The Table\n\n^=cut\n/m, |
45 | 'table comment'; |
46 | |
47 | like $code, qr/^=head2 value\n\nThe Column\n\n/m, |
48 | 'column comment'; |
49 | }, |
50 | }, |
a78e3fed |
51 | ); |
52 | |
9e978a19 |
53 | if( !$dsn || !$user ) { |
54 | $tester->skip_tests('You need to set the DBICTEST_PG_DSN, _USER, and _PASS environment variables'); |
a78e3fed |
55 | } |
56 | else { |
57 | $tester->run_tests(); |
58 | } |