Fix incorrect exception propagation in ::Replicated::execute_reliably
[dbsrgits/DBIx-Class.git] / t / storage / replicated.t
index b735e0f..95a6d9f 100644 (file)
@@ -713,9 +713,19 @@ ok my $reliably = sub {
     is $debug{storage_type}, 'MASTER',
         "got last query from a master: $debug{dsn}";
 
+    $_[1] = 9;
+
 } => 'created coderef properly';
 
-$replicated->schema->storage->execute_reliably($reliably);
+my @list_to_mangle = (1, 2, 3);
+
+$replicated->schema->storage->execute_reliably($reliably, @list_to_mangle);
+
+is_deeply
+  \@list_to_mangle,
+  [ 1, 9, 3],
+  'Aliasing of values passed to execute_reliably works'
+;
 
 ## Try something with an error
 
@@ -730,6 +740,12 @@ throws_ok {$replicated->schema->storage->execute_reliably($unreliably)}
     qr/Can't find source for ArtistXX/
     => 'Bad coderef throws proper error';
 
+throws_ok {
+  $replicated->schema->storage->execute_reliably(sub{
+    die bless [], 'SomeExceptionThing';
+  });
+} 'SomeExceptionThing', "Blessed exception kept intact";
+
 ## Make sure replication came back
 
 ok $replicated->schema->resultset('Artist')->find(3)