Fix skip count when DB2 extra schema creation fails
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 23dumpmore.t
index 47364f5..9490b2f 100644 (file)
@@ -189,7 +189,7 @@ $t->dump_test(
       qr/\n=head1 TABLE: C<foo>\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<DBICTest::DumpMore::1::Bar>\n\n=cut\n\n/,
@@ -580,7 +580,7 @@ $t->dump_test(
     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/,
         ],
     },
 );
@@ -599,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: