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