[Bast-commits] r5251 - DBIx-Class/0.08/trunk/t

ash at dev.catalyst.perl.org ash at dev.catalyst.perl.org
Tue Dec 16 23:45:51 GMT 2008


Author: ash
Date: 2008-12-16 23:45:51 +0000 (Tue, 16 Dec 2008)
New Revision: 5251

Modified:
   DBIx-Class/0.08/trunk/t/103many_to_many_warning.t
Log:
Try to fix test on 5.10

Modified: DBIx-Class/0.08/trunk/t/103many_to_many_warning.t
===================================================================
--- DBIx-Class/0.08/trunk/t/103many_to_many_warning.t	2008-12-16 23:27:57 UTC (rev 5250)
+++ DBIx-Class/0.08/trunk/t/103many_to_many_warning.t	2008-12-16 23:45:51 UTC (rev 5251)
@@ -6,24 +6,25 @@
 
 
 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 @@
 
 {
   package #
-    DBICTest::Schema::Foo;
+    DBICTest::Schema::Foo$suffix;
   use base 'DBIx::Class::Core';
   __PACKAGE__->table('foo');
   __PACKAGE__->add_columns(
@@ -45,13 +46,13 @@
   __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 @@
       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 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;




More information about the Bast-commits mailing list