X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Fdbh_do.t;h=0beb8581ebec45bdcbbe30082ef08b5887db8dd9;hb=wip%2Fmssql-2012-limit-dialect;hp=82e33d81920e992b43ffeeaffd9ff6e00b9c79d0;hpb=f54428abf9cc7d7e5604745335694eaf558f6820;p=dbsrgits%2FDBIx-Class.git diff --git a/t/storage/dbh_do.t b/t/storage/dbh_do.t index 82e33d8..0beb858 100644 --- a/t/storage/dbh_do.t +++ b/t/storage/dbh_do.t @@ -9,6 +9,16 @@ use DBICTest; my $schema = DBICTest->init_schema(); my $storage = $schema->storage; +# test (re)connection +for my $disconnect (0, 1) { + $schema->storage->_dbh->disconnect if $disconnect; + is_deeply ( + $schema->storage->dbh_do(sub { $_[1]->selectall_arrayref('SELECT 1') }), + [ [ 1 ] ], + 'dbh_do on fresh handle worked', + ); +} + my @args; my $test_func = sub { @args = @_ }; @@ -31,9 +41,11 @@ is_deeply ( [ $storage, $storage->dbh, "baz", "buz" ], ); -# test aliasing +# test nested aliasing my $res = 'original'; -$storage->dbh_do (sub { $_[2] = 'changed' }, $res); +$storage->dbh_do (sub { + shift->dbh_do(sub { $_[3] = 'changed' }, @_) +}, $res); is ($res, 'changed', "Arguments properly aliased for dbh_do");