Commit | Line | Data |
5c06aa08 |
1 | use strict; |
a79e1189 |
2 | use warnings; |
5c06aa08 |
3 | use Test::More; |
4 | use Test::Exception; |
5 | use Test::Warn; |
a79e1189 |
6 | use DBIx::Class::Schema::Loader::Utils 'slurp_file'; |
5c06aa08 |
7 | use File::Path; |
a79e1189 |
8 | use lib qw(t/lib); |
5c06aa08 |
9 | use make_dbictest_db_comments; |
10 | use dbixcsl_test_dir qw/$tdir/; |
11 | |
12 | my $dump_path = "$tdir/dump"; |
13 | |
14 | { |
15 | package DBICTest::Schema::1; |
16 | use base qw/ DBIx::Class::Schema::Loader /; |
17 | __PACKAGE__->loader_options( |
18 | dump_directory => $dump_path, |
a47e6e74 |
19 | quiet => 1, |
5c06aa08 |
20 | ); |
21 | } |
22 | |
23 | DBICTest::Schema::1->connect($make_dbictest_db_comments::dsn); |
24 | |
25 | plan tests => 4; |
26 | |
a79e1189 |
27 | my $foo = slurp_file("$dump_path/DBICTest/Schema/1/Result/Foo.pm"); |
28 | my $bar = slurp_file("$dump_path/DBICTest/Schema/1/Result/Bar.pm"); |
5c06aa08 |
29 | |
30 | like($foo, qr/Result::Foo - a short comment/, 'Short table comment inline'); |
31 | like($bar, qr/Result::Bar\n\n=head1 DESCRIPTION\n\na (very ){80}long comment/, |
32 | 'Long table comment in DESCRIPTION'); |
33 | |
34 | like($foo, qr/=head2 fooid\n\n( .*\n)+\na short comment/, |
35 | 'Short column comment recorded'); |
36 | like($foo, qr/=head2 footext\n\n( .*\n)+\na (very ){80}long comment/, |
37 | 'Long column comment recorded'); |
38 | |
39 | END { rmtree($dump_path, 1, 1); } |