From: Ash Berlin Date: Tue, 16 Dec 2008 23:45:51 +0000 (+0000) Subject: Try to fix test on 5.10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=89d1d25783ca743bbf77afb825d2c14edd0e6544;p=dbsrgits%2FDBIx-Class-Historic.git Try to fix test on 5.10 --- diff --git a/t/103many_to_many_warning.t b/t/103many_to_many_warning.t index ff48590..de602d2 100644 --- a/t/103many_to_many_warning.t +++ b/t/103many_to_many_warning.t @@ -6,24 +6,25 @@ use lib qw(t/lib); our $no_warn = ""; +our $suffix = ""; plan tests => 2; { local $@; local $SIG{__WARN__} = sub { die @_ }; eval "@{[code()]}"; - ok($@, "Warning triggered without relevant 'no warnings'"); + like($@, qr/The many-to-many relationship bars/, + "Warning triggered without relevant 'no warnings'"); } { - # Clean up the packages - delete $INC{'DBICTest/ManyToManyWarning.pm'}; - delete $DBICTest::{"Schema::"}; $no_warn = "no warnings 'DBIx::Class::Relationship::ManyToMany';"; + $suffix = "2"; local $SIG{__WARN__} = sub { die @_ }; eval "@{[code()]}"; - ok(!$@, "No Warning triggered with relevant 'no warnings'"); + unlike($@, qr/The many-to-many relationship bars.*?Bar2/s, + "No warning triggered with relevant 'no warnings'"); } sub code { @@ -33,7 +34,7 @@ use warnings; { package # - DBICTest::Schema::Foo; + DBICTest::Schema::Foo$suffix; use base 'DBIx::Class::Core'; __PACKAGE__->table('foo'); __PACKAGE__->add_columns( @@ -45,13 +46,13 @@ use warnings; __PACKAGE__->set_primary_key('fooid'); - __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar' => 'bar'); + __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar$main::suffix' => 'bar'); __PACKAGE__->many_to_many( foos => foo_to_bar => 'bar' ); } { package # - DBICTest::Schema::FooToBar; + DBICTest::Schema::FooToBar$suffix; use base 'DBIx::Class::Core'; __PACKAGE__->table('foo_to_bar'); @@ -63,12 +64,12 @@ use warnings; data_type => 'integer', }, ); - __PACKAGE__->belongs_to('foo' => 'DBICTest::Schema::Foo'); - __PACKAGE__->belongs_to('bar' => 'DBICTest::Schema::Foo'); + __PACKAGE__->belongs_to('foo' => 'DBICTest::Schema::Foo$main::suffix'); + __PACKAGE__->belongs_to('bar' => 'DBICTest::Schema::Foo$main::suffix'); } { package # - DBICTest::Schema::Bar; + DBICTest::Schema::Bar$suffix; use base 'DBIx::Class::Core'; __PACKAGE__->table('bar'); __PACKAGE__->add_columns( @@ -81,10 +82,11 @@ use warnings; use DBIx::Class::Relationship::ManyToMany; $main::no_warn __PACKAGE__->set_primary_key('barid'); - __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar' => 'foo'); + __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar$main::suffix' => 'foo'); __PACKAGE__->many_to_many( bars => foo_to_bar => 'foo' ); sub add_to_bars {} + die $main::suffix; } EOF return $file;