X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F22dump.t;h=671021e9b8440d87d65a41fcdd4378756d3204bc;hb=7d0ea6b94e009f9d2a325f968a067357fb0b820c;hp=54193d99ab6738fa884aad0b7274edcc07b32646;hpb=3e3c3fc76dac9388e1b34f82c8ad46645af4eb1a;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/t/22dump.t b/t/22dump.t index 54193d9..671021e 100644 --- a/t/22dump.t +++ b/t/22dump.t @@ -6,11 +6,15 @@ use make_dbictest_db; my $dump_path = './t/_dump'; +local $SIG{__WARN__} = sub { + warn $_[0] unless $_[0] =~ + /really_erase_my_files|Dumping manual schema|Schema dump completed/; +}; + { package DBICTest::Schema::1; use base qw/ DBIx::Class::Schema::Loader /; __PACKAGE__->loader_options( - relationships => 1, dump_directory => $dump_path, ); } @@ -19,31 +23,47 @@ my $dump_path = './t/_dump'; package DBICTest::Schema::2; use base qw/ DBIx::Class::Schema::Loader /; __PACKAGE__->loader_options( - relationships => 1, dump_directory => $dump_path, - dump_overwrite => 1, + really_erase_my_files => 1, ); } -plan tests => 4; +plan tests => 5; -rmtree($dump_path, 1, 0711); +rmtree($dump_path, 1, 1); eval { DBICTest::Schema::1->connect($make_dbictest_db::dsn) }; ok(!$@, 'no death with dump_directory set') or diag "Dump failed: $@"; -DBICTest::Schema::1->loader(undef); -eval { DBICTest::Schema::1->connect($make_dbictest_db::dsn) }; -like($@, qr|DBICTest/Schema/1.pm exists, will not overwrite|, - 'death when attempting to overwrite without option'); +DBICTest::Schema::1->_loader_invoked(undef); + +SKIP: { + my @warnings_regexes = ( + qr|Dumping manual schema|, + qr|Schema dump completed|, + ); + + skip "ActiveState perl produces additional warnings", scalar @warnings_regexes + if ($^O eq 'MSWin32'); -rmtree($dump_path, 1, 0711); + my @warn_output; + { + local $SIG{__WARN__} = sub { push(@warn_output, @_) }; + DBICTest::Schema::1->connect($make_dbictest_db::dsn); + } + + like(shift @warn_output, $_) foreach (@warnings_regexes); + + rmtree($dump_path, 1, 1); +} eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) }; -ok(!$@, 'no death with dump_directory set (overwrite1)') or diag "Dump failed: $@"; +ok(!$@, 'no death with dump_directory set (overwrite1)') + or diag "Dump failed: $@"; -DBICTest::Schema::2->loader(undef); +DBICTest::Schema::2->_loader_invoked(undef); eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) }; -ok(!$@, 'no death with dump_directory set (overwrite2)') or diag "Dump failed: $@"; +ok(!$@, 'no death with dump_directory set (overwrite2)') + or diag "Dump failed: $@"; -END { rmtree($dump_path, 1, 0711); } +END { rmtree($dump_path, 1, 1); }