X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F23dumpmore.t;h=9490b2fd2fe540e6bc06c860c8ca11aa383a05b0;hb=9ff235d2b5c3ae8d08097744344bce8f119e709b;hp=f94cc3f2a68fc58b3a20ea9b579723cc5affcea3;hpb=28310f24a72d93ca7fc3852c7458e4c05d84fe2b;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/t/23dumpmore.t b/t/23dumpmore.t index f94cc3f..9490b2f 100644 --- a/t/23dumpmore.t +++ b/t/23dumpmore.t @@ -189,7 +189,7 @@ $t->dump_test( qr/\n=head1 TABLE: C\n\n=cut\n\n__PACKAGE__->table\("foo"\);\n\n/, qr/\n=head1 ACCESSORS\n\n/, qr/\n=head2 fooid\n\n data_type: 'integer'\n is_auto_increment: 1\n is_nullable: 0\n\n/, - qr/\n=head2 footext\n\n data_type: 'text'\n default_value: 'footext'\n extra: {is_footext => 1}\n is_nullable: 1\n\n/, + qr/\n=head2 footext\n\n data_type: 'text'\n default_value: 'footext'\n extra: \{is_footext => 1\}\n is_nullable: 1\n\n/, qr/\n=head1 PRIMARY KEY\n\n=over 4\n\n=item \* L<\/fooid>\n\n=back\n\n=cut\n\n__PACKAGE__->set_primary_key\("fooid"\);\n/, qr/\n=head1 RELATIONS\n\n/, qr/\n=head2 bars\n\nType: has_many\n\nRelated object: L\n\n=cut\n\n/, @@ -387,6 +387,7 @@ $t->dump_test( constraint => [ [ qr/my_schema/ => qr/foo|bar/ ] ], exclude => [ [ qr/my_schema/ => qr/bar/ ] ], }, + generated_results => [qw(MySchema::Floop)], warnings => [ qr/^db_schema is not supported on SQLite/, ], @@ -576,9 +577,10 @@ $t->dump_test( options => { use_namespaces => 1, }, + generated_results => [qw(Foo Bar)], regexes => { 'Result/Foo' => [ - qr/sub custom_method { 'custom_method works' }\n0;\n\n# You can replace.*\n1;\n\z/, + qr/sub custom_method \{ 'custom_method works' \}\n0;\n\n# You can replace.*\n1;\n\z/, ], }, ); @@ -589,6 +591,7 @@ $t->dump_test( options => { dry_run => 1, }, + generated_results => [qw(Foo Bar)], ); my $schema_file = $t->class_file('DBICTest::DumpMore::DryRun'); @@ -596,5 +599,46 @@ ok( !-e $schema_file, "dry-run doesn't create file for schema class" ); (my $schema_dir = $schema_file) =~ s/\.pm\z//; ok( !-e $schema_dir, "dry-run doesn't create subdirectory for schema namespace" ); +# test omit_version (RT#92300) +$t->dump_test( + classname => 'DBICTest::DumpMore::omit_version', + options => { + omit_version => 1, + }, + regexes => { + Foo => [ + qr/^\# Created by DBIx::Class::Schema::Loader @ \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$/m, + ], + }, +); + +# test omit_timestamp (RT#92300) +$t->dump_test( + classname => 'DBICTest::DumpMore::omit_timestamp', + options => { + omit_timestamp => 1, + }, + regexes => { + Foo => [ + qr/^\# Created by DBIx::Class::Schema::Loader v[\d.]+$/m, + ], + }, +); + +# test omit_version and omit_timestamp simultaneously (RT#92300) +$t->dump_test( + classname => 'DBICTest::DumpMore::omit_both', + options => { + omit_version => 1, + omit_timestamp => 1, + }, + # A positive regex here would match the top comment + neg_regexes => { + Foo => [ + qr/^\# Created by DBIx::Class::Schema::Loader.+$/m, + ], + }, +); + done_testing; # vim:et sts=4 sw=4 tw=0: